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() 

Source Link

Document

Creates a mutable, initially empty HashSet instance.

Usage

From source file:org.opendaylight.yangtools.yang.parser.util.TopologicalSort.java

private static Set<Node> getDependentNodes(Set<Node> nodes) {
    Set<Node> dependentNodes = Sets.newHashSet();
    for (Node n : nodes) {
        if (n.getOutEdges().isEmpty()) {
            dependentNodes.add(n);//from w  w w.ja  v a  2  s.c o m
        }
    }
    return dependentNodes;
}

From source file:cc.recommenders.mining.calls.NoCallRecommender.java

@Override
public Set<Tuple<ICoReMethodName, Double>> query(Query query) {
    return Sets.newHashSet();
}

From source file:com.baidu.rigel.biplatform.ma.resource.utils.ElementUtils.java

/**
 * //from  ww w . j a  v a  2s  .c om
 * @param model
 * @param cube
 * @return Set<String>
 */
public static Set<String> getChangableDimNames(ReportDesignModel model, Cube cube) {

    Set<String> dimSet = Sets.newHashSet();
    List<Dimension> dimGroups = Lists.newArrayList();
    /**
     * get all dims and all dim groups
     */
    for (Dimension dimension : cube.getDimensions().values()) {
        if (dimension.getType() == DimensionType.STANDARD_DIMENSION) {
            dimSet.add(dimension.getName());
        } else if (dimension.getType() == DimensionType.GROUP_DIMENSION) {
            dimGroups.add(dimension);
        }
    }
    /**
     * get rid of ones used in table or chart
     */
    for (ExtendArea area : model.getExtendAreaList()) {
        for (Item item : area.listAllItems().values()) {
            OlapElement element = ReportDesignModelUtils.getDimOrIndDefineWithId(model.getSchema(),
                    area.getCubeId(), item.getOlapElementId());
            if (element != null) {
                dimSet.remove(element.getName());
            }
        }
    }
    /**
     * get rid of ones used in group dims
     */
    for (Dimension group : dimGroups) {
        for (Level level : group.getLevels().values()) {
            String dimName = level.getDimension().getName();
            dimSet.remove(dimName);
        }
    }
    return dimSet;
}

From source file:org.eclipse.xtext.conversion.impl.IgnoreCaseIDValueConverter.java

@Override
protected Set<String> computeValuesToEscape(Grammar grammar) {
    Set<String> result = Sets.newHashSet();
    for (String keyword : GrammarUtil.getAllKeywords(grammar))
        result.add(keyword.toLowerCase());
    return ImmutableSet.copyOf(result);
}

From source file:com.github.achatain.catalog.dto.HateoasDto.java

HateoasDto() {
    this.links = Sets.newHashSet();
}

From source file:matching.edmonds1.Matching.java

private static <T> Map<T, T> buildMatchingMap(final MutableUndirectedGraph<T> maximumMatching) {
    final Builder<T, T> builder = new ImmutableMap.Builder<T, T>();
    final Set<T> set = Sets.newHashSet();
    for (final T endPoint1 : maximumMatching) {
        final T endPoint2 = maximumMatching.getEndPoints(endPoint1).iterator().next();
        if (!set.contains(endPoint2)) {
            set.add(endPoint1);//from w  w w. j  a va2 s  . c om
            set.add(endPoint2);
            builder.put(endPoint1, endPoint2);
        }
    }
    return builder.build();
}

From source file:org.apache.cassandra.hadoop2.multiquery.MultiQueryInputSplit.java

public static MultiQueryInputSplit createFromSubplits(Collection<Subsplit> subsplits) {
    List<TokenRange> tokenRanges = Lists.newArrayList();
    Set<String> hosts = Sets.newHashSet();
    for (Subsplit subsplit : subsplits) {
        tokenRanges.add(new TokenRange(subsplit.getStartToken(), subsplit.getEndToken()));
        hosts.addAll(subsplit.getHosts());
    }// w  w w  .  j  a v a 2  s.  c o  m
    return new MultiQueryInputSplit(tokenRanges, Lists.newArrayList(hosts));
}

From source file:com.google.javascript.jscomp.VariableNameGenerator.java

VariableNameGenerator(Scope scope) {
    Set<String> usedNames = Sets.newHashSet();
    for (Iterator<Var> i = scope.getVars(); i.hasNext();) {
        usedNames.add(i.next().getName());
    }//w  ww  .j  a va 2s .  c  o  m
    names = new NameGenerator(usedNames, "", null);
}

From source file:org.polarsys.reqcycle.commands.utils.RelationCommandUtils.java

public static Set<RelationCreationDescriptor> getAllRelationCommands(List<Reachable> sourceReachables,
        List<Reachable> targetReachables) {

    Set<RelationCreationDescriptor> set = Sets.newHashSet();
    Configuration defaultConfiguration = typeConfigProvider.getContainer().getDefaultConfiguration();
    if (defaultConfiguration != null) {
        for (Reachable sourceReachable : sourceReachables) {
            for (Reachable targetReachable : targetReachables) {
                Set<RelationCreationDescriptor> matches = getMatches(sourceReachable, targetReachable,
                        defaultConfiguration);
                if (set.isEmpty()) {
                    set = matches;/*from ww w  .  jav  a  2 s  . c o m*/
                } else {
                    set = Sets.intersection(set, matches);
                }
            }
        }
    } else {
        Activator.getDefault().getLog().log(
                new Status(Status.WARNING, Activator.PLUGIN_ID, "No default Reqcycle configuration was found"));
    }

    return set;
}

From source file:extrabiomes.items.LogTurner.java

public LogTurner() {
    super(0.0f, ToolMaterial.WOOD, Sets.newHashSet());
}