Example usage for com.google.common.collect Sets newHashSet

List of usage examples for com.google.common.collect Sets newHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newHashSet.

Prototype

public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) 

Source Link

Document

Creates a mutable HashSet instance containing the given elements.

Usage

From source file:org.jamocha.filter.PathNodeFilterSet.java

public static PathNodeFilterSet newRegularPathNodeFilterSet(final PathFilter... filters) {
    return newRegularPathNodeFilterSet(Sets.newHashSet(filters));
}

From source file:us.physion.ovation.ui.importer.ImageImporter.java

public static Observable<Measurement> importImagesEpoch(EpochContainer container, Iterable<File> files) {
    List<FileMetadata> metadata = Lists.newArrayList();
    for (File f : files) {
        metadata.add(new FileMetadata(f));
    }/*  w  w  w. jav a2 s . com*/

    List<Measurement> result = Lists.newLinkedList();
    for (FileMetadata fileMetadata : metadata) {

        Epoch epoch = container.insertEpoch(fileMetadata.getStart(), fileMetadata.getEnd(false), null,
                fileMetadata.getEpochProtocolParameters(), fileMetadata.getDeviceParameters());

        for (Map<String, Object> m : fileMetadata.getMeasurements()) {
            epoch.insertMeasurement(String.format("Image %d", (Integer) m.get(FileMetadata.IMAGE_NUMBER)),
                    Sets.<String>newHashSet(), Sets.newHashSet((Set<String>) m.get(FileMetadata.DEVICE_NAMES)),
                    (URL) m.get(FileMetadata.IMAGE_URL), (String) m.get(FileMetadata.MIME_TYPE));
        }
    }

    return Observable.from(result);
}

From source file:org.polarsys.reqcycle.traceability.model.Link.java

public Link(Reachable id, TType kind, Iterable<Reachable> sources, Iterable<Reachable> targets) {
    this.id = id;
    this.kind = kind;
    this.sources = Sets.newHashSet(sources);
    this.targets = Sets.newHashSet(targets);
}

From source file:org.chiefly.nautilus.concurrent.Threads.java

/**
 * Calls {@code start()} and {@code join()} on all the {@link Thread}s.
 *
 * @param threads The {@link Thread}s to {@code start()}.
 *///from w w w .j  av a2  s . com
public static <T extends Thread> void runAllAndWait(final T... threads) throws InterruptedException {
    final Set<T> set = Sets.newHashSet(threads);
    runAllAndWait(set);
}

From source file:org.gradle.plugins.ide.idea.model.internal.GeneratedIdeaScope.java

private GeneratedIdeaScope(String... scopes) {
    this.scopes = Collections.unmodifiableSet(Sets.newHashSet(scopes));
}

From source file:com.hortonworks.streamline.streams.actions.utils.TopologyTestHelper.java

public static StreamlineSource createStreamlineSource(String id) {
    Stream stream = createDefaultStream();
    StreamlineSource source = new StreamlineSource(Sets.newHashSet(stream));
    source.setId(id);/* w  w w. j  a  va2  s  .c o  m*/
    source.setName("testSource_" + id);
    source.setConfig(new Config());
    source.setTransformationClass("dummyTransformation");
    return source;
}

From source file:com.orange.clara.cloud.servicedbdumper.task.boot.sequences.BootSequenceJob.java

@Override
@Transactional/*from ww  w.java 2s.  co m*/
public void runSequence() {
    JobEvent[] jobEvents = new JobEvent[] { JobEvent.RUNNING, JobEvent.START };
    Set<JobEvent> jobEventSet = Sets.newHashSet(jobEvents);
    this.jobRepo.updateJobFromJobEventSetToJobEventWithErrorMessage(JobEvent.ERRORED, jobEventSet,
            ERROR_MESSAGE);
}

From source file:org.fenixedu.treasury.domain.IFiscalContributor.java

public static Set<IFiscalContributor> findAll() {
    final Set<IFiscalContributor> iterable = Sets
            .newHashSet(FinantialInstitution.findAll().collect(Collectors.toList()));
    Customer.findAll().forEach(x -> iterable.add(x));

    return iterable;
}

From source file:com.platzhaltr.readr.functions.RemovePrefixFunction.java

/**
 * Instantiates a new prefix remover line transformer.
 *
 * @param prefix/*from   w ww.  j  ava  2s.c o m*/
 *            the prefix
 */
public RemovePrefixFunction(final String prefix) {
    this(Sets.newHashSet(prefix));
}

From source file:com.torodb.integration.mongo.v3m0.jstests.ToolIT.java

private static ScriptClassifier createScriptClassifier() {
    Set<Script> workingSet = getWorkingSet(), catastrophicSet = getCatastrophicSet(),
            falsePositiveSet = getFalsePositiveSet(), notImplementedSet = getNotImplementedSet(),
            ignoredSet = getIgnoredSet(), allSet = Sets.newHashSet(Iterables.concat(workingSet, catastrophicSet,
                    falsePositiveSet, notImplementedSet, ignoredSet));
    return new Builder().addScripts(Mongo, Postgres, WORKING, workingSet)
            .addScripts(Mongo, MySQL, WORKING, workingSet)

            .addScripts(Mongo, Greenplum, CATASTROPHIC, workingSet)

            .addScripts(Mongo, Postgres, CATASTROPHIC, catastrophicSet)
            .addScripts(Mongo, Greenplum, CATASTROPHIC, catastrophicSet)
            .addScripts(Mongo, MySQL, CATASTROPHIC, catastrophicSet)

            .addScripts(Mongo, Postgres, FALSE_POSITIVE, falsePositiveSet)
            .addScripts(Mongo, Greenplum, FALSE_POSITIVE, falsePositiveSet)
            .addScripts(Mongo, MySQL, FALSE_POSITIVE, falsePositiveSet)

            .addScripts(Mongo, Postgres, NOT_IMPLEMENTED, notImplementedSet)
            .addScripts(Mongo, Greenplum, NOT_IMPLEMENTED, notImplementedSet)
            .addScripts(Mongo, MySQL, NOT_IMPLEMENTED, notImplementedSet)

            .addScripts(Mongo, Postgres, IGNORED, ignoredSet).addScripts(Mongo, Greenplum, IGNORED, ignoredSet)
            .addScripts(Mongo, MySQL, IGNORED, ignoredSet)

            .addScripts(MongoReplSet, Postgres, CATASTROPHIC, allSet)
            .addScripts(MongoReplSet, Greenplum, CATASTROPHIC, allSet)
            .addScripts(MongoReplSet, MySQL, CATASTROPHIC, allSet)

            .build();/*from   ww  w  .jav  a 2  s . co  m*/
}