@Override public Set<Object> call() throws Exception { return new HashSet<Object>(); } }
@Override protected int act(List<Run<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); final HashSet<Integer> hsBuilds = new HashSet<>(); for (Run<?, ?> build : builds) { if (!hsBuilds.contains(build.number)) { build.delete(); hsBuilds.add(build.number); } } stdout.println("Deleted "+hsBuilds.size()+" builds"); return 0; }
public StringValidator(Map<String, Object> params) { this.acceptedValues = new HashSet<String>(Arrays.asList((String[]) params.get(ConfigValidationAnnotations.ValidatorParams.ACCEPTED_VALUES))); if (this.acceptedValues.isEmpty() || (this.acceptedValues.size() == 1 && this.acceptedValues.contains(""))) { this.acceptedValues = null; } }
@Test public void testCompatibilityBetweenTriples() throws Exception { final Triple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.TRUE); final Triple<Integer, String, Boolean> triple2 = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(triple, triple2); assertEquals(triple.hashCode(), triple2.hashCode()); final HashSet<Triple<Integer, String, Boolean>> set = new HashSet<>(); set.add(triple); assertTrue(set.contains(triple2)); }
private IndexLimitation[] limitationsUnion( Iterable<IndexCapability> capabilities ) { HashSet<IndexLimitation> union = new HashSet<>(); for ( IndexCapability capability : capabilities ) { union.addAll( Arrays.asList( capability.limitations() ) ); } return union.toArray( new IndexLimitation[union.size()] ); } }
@Test public void testPopulatedIdentityMap() throws Exception { HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap"); assertTrue(hasMap.getIdentityMap().size() == 2); HashSet set = new HashSet(hasMap.getIdentityMap().keySet()); assertTrue(set.contains("foo")); assertTrue(set.contains("jenny")); }
/** Sets the library as loaded, for when application code wants to handle libary loading itself. */ static public synchronized void setLoaded (String libraryName) { loadedLibraries.add(libraryName); }
@Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { String fieldDesc = className + ":" + name + ":" + desc; if (!refFieldSet.contains(fieldDesc)) { refFieldSet.add(fieldDesc); fieldCount++; } return super.visitField(access, name, desc, signature, value); } };
static public synchronized boolean isLoaded (String libraryName) { return loadedLibraries.contains(libraryName); } }
public int size() { return backingHashSet.size(); }
@Test public void testCompatibilityBetweenPairs() throws Exception { final Pair<Integer, String> pair = ImmutablePair.of(0, "foo"); final Pair<Integer, String> pair2 = MutablePair.of(0, "foo"); assertEquals(pair, pair2); assertEquals(pair.hashCode(), pair2.hashCode()); final HashSet<Pair<Integer, String>> set = new HashSet<>(); set.add(pair); assertTrue(set.contains(pair2)); pair2.setValue("bar"); assertFalse(pair.equals(pair2)); assertFalse(pair.hashCode() == pair2.hashCode()); }
/** Sets the library as loaded, for when application code wants to handle libary loading itself. */ static public synchronized void setLoaded (String libraryName) { loadedLibraries.add(libraryName); }
private static void addNamedGroups(Pattern pattern, HashSet<String> variables) { Matcher matcher = NAMED_GROUPS_PATTERN.matcher(pattern.toString()); while (matcher.find()) { String name = matcher.group(1); checkArgument(!variables.contains(name), "Multiple definitions found for variable ${" + name + "}"); variables.add(name); } }
static public synchronized boolean isLoaded (String libraryName) { return loadedLibraries.contains(libraryName); } }