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.playersun.jbf.modules.sys.service.GroupRelationService.java

public Set<Long> findGroupIds(Long userId, Set<Long> organizationIds) {

    return Sets.newHashSet(getGroupRelationRepository().findGroupIds(userId, organizationIds));

}

From source file:net.minecraftforge.client.resource.ReloadRequirements.java

/**
 * Creates an inclusive reload predicate. Only given resource types will be loaded along with this.
 *
 * @param inclusion the set of resource types to be included in the reload
 * @return an inclusion predicate based on the given types
 *///from  w w  w .  j a  v a 2s  . c om
public static Predicate<IResourceType> include(IResourceType... inclusion) {
    Set<IResourceType> inclusionSet = Sets.newHashSet(inclusion);
    return inclusionSet::contains;
}

From source file:grakn.core.graql.reasoner.cache.IndexedAnswerSet.java

public static IndexedAnswerSet create(ConceptMap answer, Index index) {
    return create(Sets.newHashSet(answer), index);
}

From source file:org.jetbrains.jet.cfg.CFGraphToDotFilePrinter.java

public static void dumpDot(File file, Collection<Pseudocode> pseudocodes) throws FileNotFoundException {
    File target = JetTestUtils.replaceExtension(file, "dot");

    PrintStream out = new PrintStream(target);

    out.println("digraph " + FileUtil.getNameWithoutExtension(file) + " {");
    int[] count = new int[1];
    Map<Instruction, String> nodeToName = new HashMap<Instruction, String>();
    for (Pseudocode pseudocode : pseudocodes) {
        dumpNodes(((PseudocodeImpl) pseudocode).getAllInstructions(), out, count, nodeToName,
                Sets.newHashSet(pseudocode.getInstructions()));
    }/*from   w w w  . j a  va  2 s.  c  om*/
    int i = 0;
    for (Pseudocode pseudocode : pseudocodes) {
        String label;
        JetElement correspondingElement = pseudocode.getCorrespondingElement();
        if (correspondingElement instanceof JetNamedDeclaration) {
            JetNamedDeclaration namedDeclaration = (JetNamedDeclaration) correspondingElement;
            label = namedDeclaration.getName();
        } else {
            label = "anonymous_" + i;
        }
        out.println("subgraph cluster_" + i + " {\n" + "label=\"" + label + "\";\n" + "color=blue;\n");
        dumpEdges(((PseudocodeImpl) pseudocode).getAllInstructions(), out, count, nodeToName);
        out.println("}");
        i++;
    }
    out.println("}");
    out.close();
}

From source file:com.opengamma.web.analytics.blotter.PropertyNameFilter.java

PropertyNameFilter(String... propertyNames) {
    ArgumentChecker.notNull(propertyNames, "propertyNames");
    _propertyNames = Sets.newHashSet(Arrays.asList(propertyNames));
}

From source file:com.epam.reportportal.utils.TagsParser.java

public static Set<String> parseAsSet(String rawTags) {
    if (null == rawTags) {
        return null;
    }//from  ww w .j a v a 2 s .  co  m
    return Sets.newHashSet(rawTags.trim().split(";"));
}

From source file:net.roddrim.number5.tools.collect.FluentSet.java

public static <E> FluentSet<E> of(@NonNull final E... elements) {
    return of(Sets.newHashSet(elements));
}

From source file:objenome.AbstractMultitainer.java

default Builder any(Class<?> abstractClass, Class<?>[] klasses) {
    if (klasses.length == 0)
        usable(abstractClass, abstractClass);

    int uniques = Sets.newHashSet(klasses).size();
    if (uniques == 1) {
        return use(abstractClass, klasses[0]);
    }/*w  ww .j a  va  2s  . c  o m*/

    return any(abstractClass, Scope.NONE, klasses);
}

From source file:com.googlecode.blaisemath.graph.NodeSetInGraph.java

/**
 * Factory method for creating a node set.
 * @param <E> node type//from  ww  w.ja v a  2s  .c  o m
 * @param nodes nodes
 * @return node set data structure
 */
public static <E> NodeSetInGraph<E> create(E... nodes) {
    return new NodeSetInGraph<E>(Sets.newHashSet(nodes), null);
}

From source file:com.axemblr.service.cm.models.cm.ServiceSetupList.java

public ServiceSetupList(ServiceSetupInfo serviceSetupInfo) {
    this(Sets.newHashSet(serviceSetupInfo));
}