commonNodes.retainAll(v2Nodes);
public void testElementSetSubsetRetainAll() { TreeMultiset<String> ms = TreeMultiset.create(); ms.add("a", 1); ms.add("b", 3); ms.add("c", 2); ms.add("d", 1); ms.add("e", 3); ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); assertThat(elementSet).containsExactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); assertThat(subset).containsExactly("b", "c", "d", "e").inOrder(); assertTrue(subset.retainAll(Arrays.asList("a", "c"))); assertThat(elementSet).containsExactly("a", "c", "f").inOrder(); assertThat(subset).containsExactly("c"); assertEquals(5, ms.size()); }
merged.retainAll( results );
/** * @param c * @return * @see java.util.AbstractCollection#retainAll(java.util.Collection) */ public boolean retainAll(Collection<?> c) { return set.retainAll(c); }
@Override public boolean retainAll(Collection<?> clctn) { return sortedSet.retainAll(clctn); }
@Override public boolean retainAll(Collection<?> c) { return delegate.retainAll(c); }
@Override public synchronized boolean retainAll(Collection<?> c) { SortedSet<E> newSet = new TreeSet<E>(internalSet); boolean changed = newSet.retainAll(c); internalSet = newSet; return changed; }
@Override public synchronized boolean retainAll(Collection<?> c) { SortedSet<E> newSet = new TreeSet<E>(internalSet); boolean changed = newSet.retainAll(c); internalSet = newSet; return changed; }
@Override public boolean retainAll(Collection<?> c) { if (persisted) { throw new IllegalStateException("Unable to modify a persisted FileSortedSet. Please call load() first."); } else { return set.retainAll(c); } }
public void setMobilityGroupsAsList(List<OutboundMobilityCandidacyContestGroup> mobilityGroupsAsList) { this.mobilityGroups.retainAll(mobilityGroupsAsList); this.mobilityGroups.addAll(mobilityGroupsAsList); }
public synchronized boolean retainAll(Collection<?> c) { list.clear(); return set.retainAll(c); }
public void setCandidacyPeriodsAsList(List<OutboundMobilityCandidacyPeriod> candidacyPeriodsAsList) { this.candidacyPeriods.retainAll(candidacyPeriodsAsList); this.candidacyPeriods.addAll(candidacyPeriodsAsList); }
public void setMobilityProgramsAsList(List<MobilityProgram> mobilityProgramsAsList) { this.mobilityPrograms.retainAll(mobilityProgramsAsList); this.mobilityPrograms.addAll(mobilityProgramsAsList); }
public boolean retainAll(Collection<?> c) { assertNotImmutable(); return mDefinitions.retainAll(c); }
public boolean retainAll(Collection<?> c) { assertNotImmutable(); return mDefinitions.retainAll(c); }
/** * Returns the attribute Definitions which are shared by all subclasses of this JavaBaseClass * * @return attributes */ public PuzzlePieceSet getBaseAttributes() { SortedSet<PuzzlePiece> attributes = new TreeSet<PuzzlePiece>(mSubelements.last().getAttributes()); for (PuzzlePiece subelement : mSubelements.headSet(mSubelements.last())) { attributes.retainAll(subelement.getAttributes()); } return new PuzzlePieceSet(attributes); }
/** * Returns the attribute Definitions which are shared by all subclasses of this JavaBaseClass * * @return attributes */ public PuzzlePieceSet getBaseAttributes() { SortedSet<PuzzlePiece> attributes = new TreeSet<PuzzlePiece>(mSubelements.last().getAttributes()); for (PuzzlePiece subelement : mSubelements.headSet(mSubelements.last())) { attributes.retainAll(subelement.getAttributes()); } return new PuzzlePieceSet(attributes); }
/** Returns the set of the optical slots ids that are idle in ALL the fibers provided * @param wdmLinks the set of fibers * @return see above */ public SortedSet<Integer> getAvailableSlotIds (Collection<WFiber> wdmLinks) { if (wdmLinks.isEmpty()) throw new Net2PlanException ("No WDM links"); final SortedSet<Integer> validSlotIds = this.getIdleOpticalSlotIds(wdmLinks.iterator().next()); final Iterator<WFiber> itLink = wdmLinks.iterator(); itLink.next(); while (itLink.hasNext()) validSlotIds.retainAll(this.getIdleOpticalSlotIds(itLink.next())); return validSlotIds; }
private static double computeKappa(SortedMap<String, String> expert1Labels, SortedMap<String, String> expert2Labels) throws IOException { // intersection SortedSet<String> intersectionIDs = new TreeSet<>(); intersectionIDs.addAll(expert1Labels.keySet()); intersectionIDs.retainAll(expert2Labels.keySet()); CodingAnnotationStudy study = new CodingAnnotationStudy(2); for (String id : intersectionIDs) { String expert1 = expert1Labels.get(id); String expert2 = expert2Labels.get(id); study.addItem(expert1, expert2); } CohenKappaAgreement kappa = new CohenKappaAgreement(study); return kappa.calculateCategoryAgreement("3"); } }
public void testElementSetSubsetRetainAll() { TreeMultiset<String> ms = TreeMultiset.create(); ms.add("a", 1); ms.add("b", 3); ms.add("c", 2); ms.add("d", 1); ms.add("e", 3); ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); assertThat(elementSet).containsExactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); assertThat(subset).containsExactly("b", "c", "d", "e").inOrder(); assertTrue(subset.retainAll(Arrays.asList("a", "c"))); assertThat(elementSet).containsExactly("a", "c", "f").inOrder(); assertThat(subset).containsExactly("c"); assertEquals(5, ms.size()); }