List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:com.google.devtools.depan.nodes.Graphs.java
/** * Computes a set of nodes in this graph that satisfy any of the filters in * <code>finder</code> using <code>nodeSet</code> as input. * * @param nodeSet A collection of nodes that are used as starting points. * @param finder Finder object that contains the filters. * @return A collection of nodes that satisfy filters with the given input. *///from www. ja va 2s . com static public Collection<GraphNode> getRelated(GraphModel model, Collection<GraphNode> nodeSet, GraphEdgeMatcher edgeMatcher) { Collection<GraphNode> result = Sets.newHashSet(); for (GraphEdge edge : model.getEdges()) { if (nodeSet.contains(edge.getHead()) && edgeMatcher.edgeForward(edge)) { result.add(edge.getTail()); } if (nodeSet.contains(edge.getTail()) && edgeMatcher.edgeReverse(edge)) { result.add(edge.getHead()); } } return result; }
From source file:com.reprezen.kaizen.oasparser.jsonoverlay.ResolutionBase.java
public static Collection<ResolutionBase> getAllBases() { Set<ResolutionBase> allBases = Sets.newHashSet(); // cull duplicates caused by aliased entries allBases.addAll(instances.values()); return allBases; }
From source file:org.gradle.internal.reflect.Types.java
/** * Visits all types in a type hierarchy in breadth-first order, super-classes first and then implemented interfaces. * * @param clazz the type of whose type hierarchy to visit. * @param excludedTypes the types not to walk when encountered in the hierarchy. * @param visitor the visitor to call for each type in the hierarchy. *//* w w w . j av a 2 s . c o m*/ public static <T> void walkTypeHierarchy(Class<T> clazz, Collection<Class<?>> excludedTypes, TypeVisitor<? extends T> visitor) { Set<Class<?>> seenInterfaces = Sets.newHashSet(); Queue<Class<? super T>> queue = new ArrayDeque<Class<? super T>>(); queue.add(clazz); Class<? super T> type; while ((type = queue.poll()) != null) { if (excludedTypes.contains(type)) { continue; } visitor.visitType(type); Class<? super T> superclass = type.getSuperclass(); if (superclass != null) { queue.add(superclass); } for (Class<?> iface : type.getInterfaces()) { if (seenInterfaces.add(iface)) { queue.add(Cast.<Class<? super T>>uncheckedCast(iface)); } } } }
From source file:org.splevo.vpm.analyzer.semantic.extensionpoint.SemanticContent.java
/** * The default constructor.//w w w.j a va 2 s .c om */ public SemanticContent() { this.code = Sets.newHashSet(); this.comments = new LinkedList<String>(); }
From source file:qa.qcri.nadeef.core.solver.SolverBase.java
/** * Default solver behavior. It does not restrict the changing cells. *///from www .j av a2 s. c o m public List<Fix> solve(HashSet<Fix> repairContext) { HashSet<Cell> cells = Sets.newHashSet(); for (Fix fix : repairContext) { cells.add(fix.getLeft()); if (!fix.isRightConstant()) cells.add(fix.getRight()); } return solve(repairContext, cells); }
From source file:com.daphne.es.tmp.parentchild.Parent.java
public Set<Child> getChilds() { if (childs == null) { childs = Sets.newHashSet(); } return childs; }
From source file:com.google.security.zynamics.binnavi.Plugins.JarLoader.java
/** * Finds the JAR files in the additional JAR file directory. * * @param rootPath The BinNavi root path. * * @return The list of JAR files found./*from w ww .jav a 2s . c o m*/ */ public static Set<File> collectJars(final String rootPath) { Preconditions.checkNotNull(rootPath, "IE00827: BinNavi root path can't be null"); final Set<File> jarFiles = Sets.newHashSet(); final File jarDirectory = new File(rootPath + File.separator + JAR_DIRECTORY); DirUtils.traverse(jarDirectory, new IDirectoryTraversalCallback() { @Override public void entering(final File directory) { // Not necessary } @Override public void leaving(final File directory) { // Not necessary } @Override public void nextFile(final File file) { if (!FileUtils.getFileExtension(file).equals("jar")) { return; } jarFiles.add(file); } }); return jarFiles; }
From source file:com.lastcalc.parsers.amounts.UnitParser.java
public static Set<UnitParser> getParsers() { final Set<UnitParser> ret = Sets.newHashSet(); addParsers(ret, SI.class); // Add various prefixes, iterate through a copy of ret // to prevent concurrent modification exception for (final UnitParser up : Sets.newHashSet(ret)) { if (up.template.size() > 1) { continue; }//from ww w . j av a 2s .c om ret.add(new UnitParser(SI.ATTO(up.unit), TokenList.createD("atto" + up.template.get(0)))); ret.add(new UnitParser(SI.CENTI(up.unit), TokenList.createD("centi" + up.template.get(0)))); ret.add(new UnitParser(SI.DECI(up.unit), TokenList.createD("deci" + up.template.get(0)))); ret.add(new UnitParser(SI.DEKA(up.unit), TokenList.createD("deka" + up.template.get(0)))); ret.add(new UnitParser(SI.EXA(up.unit), TokenList.createD("exa" + up.template.get(0)))); ret.add(new UnitParser(SI.FEMTO(up.unit), TokenList.createD("femto" + up.template.get(0)))); ret.add(new UnitParser(SI.GIGA(up.unit), TokenList.createD("giga" + up.template.get(0)))); ret.add(new UnitParser(SI.HECTO(up.unit), TokenList.createD("hecto" + up.template.get(0)))); ret.add(new UnitParser(SI.KILO(up.unit), TokenList.createD("kilo" + up.template.get(0)))); ret.add(new UnitParser(SI.MEGA(up.unit), TokenList.createD("mega" + up.template.get(0)))); ret.add(new UnitParser(SI.MICRO(up.unit), TokenList.createD("micro" + up.template.get(0)))); ret.add(new UnitParser(SI.MILLI(up.unit), TokenList.createD("milli" + up.template.get(0)))); ret.add(new UnitParser(SI.NANO(up.unit), TokenList.createD("nano" + up.template.get(0)))); ret.add(new UnitParser(SI.PETA(up.unit), TokenList.createD("peta" + up.template.get(0)))); ret.add(new UnitParser(SI.PICO(up.unit), TokenList.createD("pico" + up.template.get(0)))); ret.add(new UnitParser(SI.TERA(up.unit), TokenList.createD("tera" + up.template.get(0)))); ret.add(new UnitParser(SI.YOCTO(up.unit), TokenList.createD("yocto" + up.template.get(0)))); ret.add(new UnitParser(SI.ZEPTO(up.unit), TokenList.createD("zepto" + up.template.get(0)))); ret.add(new UnitParser(SI.ZETTA(up.unit), TokenList.createD("zetta" + up.template.get(0)))); } addParsers(ret, NonSI.class); verboseNamesPlur.put(NonSI.FOOT, "feet"); ret.add(new UnitParser(NonSI.FOOT, TokenList.createD("feet"))); verboseNamesPlur.put(NonSI.INCH, "inches"); ret.add(new UnitParser(NonSI.INCH, TokenList.createD("inches"))); return ret; }
From source file:com.zaradai.net.authentication.AcceptIfOnApprovedListConnectionAuthenticator.java
protected Set<InetSocketAddress> createApprovedList() { return Sets.newHashSet(); }
From source file:org.openqa.selenium.android.intents.IntentReceiverRegistrar.java
public IntentReceiverRegistrar(Context context) { this.context = context; receivers = Sets.newHashSet(); }