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:com.citytechinc.cq.clientlibs.core.domain.sling.runmode.SlingRunModeGroups.java

/**
 * Produces a SlingRunMode object for a composite run mode string.  A composite run mode string
 * is a period delimited set of run modes.  Such a string may contain 0 or more run modes.
 *
 * @param compositeRunMode//from  w w  w. ja v  a 2 s  . c o  m
 * @return
 */
public static SlingRunModeGroup forCompositeRunMode(String compositeRunMode) {

    return new BasicSlingRunModeGroup(Sets.newHashSet(compositeRunMode.split("\\.")));
}

From source file:io.mindmaps.graql.query.QueryUtil.java

public static void assertResultsMatch(Iterable<Map<String, Concept>> query, String var, String type,
        String... expectedIds) {//from www .  j  ava  2  s  .c o m
    Set<String> expectedSet = Sets.newHashSet(expectedIds);
    Set<String> unfoundSet = Sets.newHashSet(expectedIds);

    query.forEach(results -> {
        assertEquals(1, results.size());
        Concept result = results.get(var);
        assertNotNull(result);
        String id = result.getId();
        assertTrue("Unexpected id: " + id, expectedSet.contains(id));
        unfoundSet.remove(id);
        if (type != null)
            assertEquals(type, result.type().getId());
    });

    assertTrue("expected ids not found: " + unfoundSet, unfoundSet.isEmpty());
}

From source file:org.ow2.proactive.connector.iaas.fixtures.NetworkFixtures.java

public static Network getNetwork(String netowrkId, String publicAddress, String privateAddress) {
    return new Network(Sets.newHashSet(netowrkId), Sets.newHashSet(publicAddress),
            Sets.newHashSet(privateAddress));
}

From source file:com.bitranger.parknshop.common.recommend.util.TypeUtils.java

public static <T> Set<Class<? extends T>> findTypes(Iterable<? extends T> objects, Class<T> parent) {
    Set<Class<? extends T>> objTypes = Sets.newHashSet(transform(objects, extractClass(parent)));

    Set<Class<? extends T>> allTypes = new HashSet<Class<? extends T>>();
    for (Class<? extends T> t : objTypes) {
        addAll(allTypes, transform(filter(typeClosure(t), isSubclass(parent)), asSubclass(parent)));
    }// w w  w .jav  a 2s .c o m
    return allTypes;
}

From source file:org.polarsys.reqcycle.repository.connector.update.ValidateUriConnector.java

private static Set<String> loadExtensions() {
    final IConfigurationElement[] elements = Platform.getExtensionRegistry()
            .getConfigurationElementsFor("org.eclipse.emf.ecore", "extension_parser");
    HashSet<String> set = Sets.newHashSet(
            Iterables.transform(Arrays.asList(elements), new Function<IConfigurationElement, String>() {
                @Override// w w w .  j a va 2 s. c o  m
                public String apply(IConfigurationElement arg0) {
                    return arg0.getAttribute("type").toLowerCase();
                }
            }));
    set.add("xmi");
    return set;
}

From source file:ezbake.thrift.authentication.X509Utils.java

public static Set<String> getOUs(LdapName name) {
    return Sets.newHashSet(getValueOfType(name, DnFields.OU));
}

From source file:org.polymap.rhei.fulltext.address.AddressFeatureTransformer.java

protected static Set<String> newSet(String... elms) {
    return Sets.newHashSet(elms);
}

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

/**
 * Calls {@code start()} on all the {@link Thread}s and returns.
 *
 * @param threads The {@link Thread}s to {@code start()}.
 *///from  w  w w. j  a v a  2s. c  o m
public static <T extends Thread> void runAll(final T... threads) {
    final Set<T> set = Sets.newHashSet(threads);
    runAll(set);
}

From source file:com.centretown.planets.server.dao.objectify.Deref.java

public static <T> Set<T> deref(Collection<Ref<T>> reflist, Class<?>... groups) {
    if (reflist == null) {
        return null;
    }/*w  w w. ja  v a  2  s  .c  o m*/
    return Sets.newHashSet(values(reflist, groups).values());
}

From source file:edu.byu.nlp.data.streams.StopWordRemover.java

public static Set<String> malletStopWords() {
    return Sets.newHashSet(Files2.open(StopWordRemover.class, MALLET_STOP_WORDS_FILE));
}