@Override public IntSet intersection(IntSet that) throws UnimplementedError { if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.intersection(b.impl); } else if (that instanceof BitVectorIntSet) { return impl.intersection(that); } else { Assertions.UNREACHABLE("Unexpected: " + that); return null; } }
@Override public IntSet intersection(IntSet that) throws UnimplementedError { if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.intersection(b.impl); } else if (that instanceof BitVectorIntSet) { return impl.intersection(that); } else { Assertions.UNREACHABLE("Unexpected: " + that); return null; } }
@Override public IntSet intersection(IntSet that) throws UnimplementedError { if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.intersection(b.impl); } else if (that instanceof BitVectorIntSet) { return impl.intersection(that); } else { Assertions.UNREACHABLE("Unexpected: " + that); return null; } }
/** * This implementation must not despoil the original value of "this" * * @return a new IntSet which is the intersection of this and that */ @Override public IntSet intersection(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; IntSet ppr = primaryImpl.intersection(db.primaryImpl); IntSet ssr = secondaryImpl.intersection(db.secondaryImpl); assert ppr.sameValue(ssr); return ppr; } else { Assertions.UNREACHABLE(); return null; } }
/** * This implementation must not despoil the original value of "this" * * @return a new IntSet which is the intersection of this and that */ @Override public IntSet intersection(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; IntSet ppr = primaryImpl.intersection(db.primaryImpl); IntSet ssr = secondaryImpl.intersection(db.secondaryImpl); assert ppr.sameValue(ssr); return ppr; } else { Assertions.UNREACHABLE(); return null; } }
/** * This implementation must not despoil the original value of "this" * * @return a new IntSet which is the intersection of this and that */ @Override public IntSet intersection(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; IntSet ppr = primaryImpl.intersection(db.primaryImpl); IntSet ssr = secondaryImpl.intersection(db.secondaryImpl); assert ppr.sameValue(ssr); return ppr; } else { Assertions.UNREACHABLE(); return null; } }
IntSet i = a.intersection(temp); Assert.assertTrue(i.sameValue(SparseIntSet.singleton(7))); a.add(100); a.remove(1); Assert.assertTrue(a.isEmpty()); i = a.intersection(temp); Assert.assertTrue(a.isEmpty()); i = a.intersection(temp); Assert.assertTrue(i.sameValue(SparseIntSet.singleton(7))); a.add(100); a.remove(1); Assert.assertTrue(a.isEmpty()); i = a.intersection(temp); Assert.assertTrue(a.isEmpty());