List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:com.cloudera.nav.sdk.model.entities.TagChangeSet.java
public TagChangeSet() { newTags = Sets.newHashSet(); delTags = Sets.newHashSet(); overrideTags = null; }
From source file:cc.kave.episodes.model.TargetsCategorization.java
public Map<String, Set<Episode>> categorize(Set<Episode> targets) { assertTrue(!targets.isEmpty(), "The set of validation data is empty!"); Map<String, Set<Episode>> categories = new LinkedHashMap<String, Set<Episode>>(); categories.put("0-1", Sets.newHashSet()); categories.put("2", Sets.newHashSet()); categories.put("3", Sets.newHashSet()); categories.put("4", Sets.newHashSet()); categories.put("5", Sets.newHashSet()); categories.put("6-9", Sets.newHashSet()); categories.put("10-19", Sets.newHashSet()); categories.put("20-29", Sets.newHashSet()); categories.put("30-66", Sets.newHashSet()); for (Episode target : targets) { int numInvoc = target.getNumEvents() - 1; assertTrue(numInvoc < 67, "Review the pre-defined categories!"); if (numInvoc == 0 || numInvoc == 1) { categories.get("0-1").add(target); continue; }//from www. ja v a 2 s. co m if (numInvoc == 2) { categories.get("2").add(target); continue; } if (numInvoc == 3) { categories.get("3").add(target); continue; } if (numInvoc == 4) { categories.get("4").add(target); continue; } if (numInvoc == 5) { categories.get("5").add(target); continue; } if (numInvoc > 5 && numInvoc < 10) { categories.get("6-9").add(target); continue; } if (numInvoc > 9 && numInvoc < 20) { categories.get("10-19").add(target); continue; } if (numInvoc > 19 && numInvoc < 30) { categories.get("20-29").add(target); continue; } if (numInvoc > 29 && numInvoc < 67) { categories.get("30-66").add(target); continue; } } return categories; }
From source file:tv.icntv.recommend.algorithm.correlate.CorrelateOutPutReducer.java
@Override protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { Set<String> result = Sets.newHashSet(); for (Iterator<Text> it = values.iterator(); it.hasNext();) { result.add(it.next().toString()); }/*from www . ja va2 s.co m*/ context.write(key, new Text(result.toString())); }
From source file:com.zaradai.distributor.messaging.Message.java
protected Set<InetSocketAddress> createTargetSet() { return Sets.newHashSet(); }
From source file:com.google.vb2js.GlobalState.java
GlobalState() { this.withNames = new Stack<String>(); this.globalNames = Sets.newHashSet(); this.localNames = Sets.newHashSet(); }
From source file:com.android.tools.idea.gradle.project.GradleProjectDependencyParser.java
@NotNull private static Set<String> parse(@NotNull VirtualFile moduleRoot, @NotNull Project project) { VirtualFile buildFile = moduleRoot.findChild(FN_BUILD_GRADLE); if (buildFile == null) { return Collections.emptySet(); } else {/*from www.jav a 2 s .c om*/ Set<String> result = Sets.newHashSet(); GradleBuildModel buildModel = parseBuildFile(buildFile, project); DependenciesModel dependenciesModel = buildModel.dependencies(); if (dependenciesModel != null) { for (ModuleDependencyModel dependency : dependenciesModel.modules()) { String modulePath = dependency.path().value(); result.add(modulePath); } } return result; } }
From source file:org.sonar.core.component.ComponentQuery.java
private ComponentQuery() { this.ids = Sets.newHashSet(); this.qualifiers = Sets.newHashSet(); }
From source file:com.google.inject.grapher.DefaultRootKeySetCreator.java
@Override public Set<Key<?>> getRootKeys(Injector injector) { Set<Key<?>> root = Sets.newHashSet(); for (Key<?> key : injector.getBindings().keySet()) { if (key.getTypeLiteral().getRawType().getPackage() != Guice.class.getPackage() && !loggerKey.equals(key)) { root.add(key);/*from w w w . ja v a 2 s .co m*/ } } return root; }
From source file:rabbit.ui.internal.viewers.FilterableSupport.java
/** * Constructor. */ public FilterableSupport() { filters = Sets.newHashSet(); }
From source file:com.android.mail.preferences.SimpleBackupSharedPreference.java
public static BackupSharedPreference fromJson(final JSONObject json) throws JSONException { Object value = json.get(VALUE); if (value instanceof JSONArray) { final Set<Object> set = Sets.newHashSet(); final JSONArray array = (JSONArray) value; for (int i = 0, len = array.length(); i < len; i++) { set.add(array.get(i));/* www. j a va2 s.co m*/ } value = set; } return new SimpleBackupSharedPreference(json.getString(KEY), value); }