/** * @return true iff {@code this} is a subset of {@code that}. */ @Override public boolean isSubset(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; boolean ppr = primaryImpl.isSubset(db.primaryImpl); boolean ssr = secondaryImpl.isSubset(db.secondaryImpl); assert ppr == ssr; return ppr; } else { Assertions.UNREACHABLE(); return false; } }
/** * @return true iff {@code this} is a subset of {@code that}. */ @Override public boolean isSubset(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; boolean ppr = primaryImpl.isSubset(db.primaryImpl); boolean ssr = secondaryImpl.isSubset(db.secondaryImpl); assert ppr == ssr; return ppr; } else { Assertions.UNREACHABLE(); return false; } }
/** * @return true iff {@code this} is a subset of {@code that}. */ @Override public boolean isSubset(IntSet that) { if (that instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) that; boolean ppr = primaryImpl.isSubset(db.primaryImpl); boolean ssr = secondaryImpl.isSubset(db.secondaryImpl); assert ppr == ssr; return ppr; } else { Assertions.UNREACHABLE(); return false; } }
@Override public boolean isSubset(IntSet that) throws IllegalArgumentException { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.isSubset(b.impl); } else { // slow! BitVectorIntSet a = new BitVectorIntSet(this); BitVectorIntSet b = new BitVectorIntSet(that); return a.isSubset(b); } }
@Override public boolean isSubset(IntSet that) throws IllegalArgumentException { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.isSubset(b.impl); } else { // slow! BitVectorIntSet a = new BitVectorIntSet(this); BitVectorIntSet b = new BitVectorIntSet(that); return a.isSubset(b); } }
@Override public boolean isSubset(IntSet that) throws IllegalArgumentException { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof BimodalMutableIntSet) { BimodalMutableIntSet b = (BimodalMutableIntSet) that; return impl.isSubset(b.impl); } else { // slow! BitVectorIntSet a = new BitVectorIntSet(this); BitVectorIntSet b = new BitVectorIntSet(that); return a.isSubset(b); } }
Assert.assertTrue(IntSetUtil.diff(v, z, factory).sameValue(SparseIntSet.singleton(17))); Assert.assertTrue(IntSetUtil.diff(z, v, factory).isEmpty()); Assert.assertTrue(z.isSubset(v)); temp = factory.make(); temp.add(4); Assert.assertTrue(a.isSubset(b)); Assert.assertFalse(a.isSubset(b)); b.remove(0); Assert.assertFalse(a.isSubset(b)); a.remove(1); Assert.assertTrue(a.isEmpty()); Assert.assertTrue(e.isSubset(d)); e.addAll(d); Assert.assertTrue(e.isSubset(d)); e.remove(12); Assert.assertTrue(e.isSubset(d)); e.add(105); Assert.assertFalse(e.isSubset(d)); Assert.assertFalse(b.isSubset(a)); Assert.assertFalse(b.isSubset(a)); Assert.assertFalse(b.isSubset(a)); Assert.assertFalse(c.isSubset(b));