@Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("null that"); } if (that instanceof SparseIntSet) { return isSubsetInternal((SparseIntSet) that); } else if (that instanceof BitVectorIntSet) { return isSubsetInternal((BitVectorIntSet) that); } else { // really slow. optimize as needed. for (IntIterator it = intIterator(); it.hasNext();) { if (!that.contains(it.next())) { return false; } } return true; } }
@Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("null that"); } if (that instanceof SparseIntSet) { return isSubsetInternal((SparseIntSet) that); } else if (that instanceof BitVectorIntSet) { return isSubsetInternal((BitVectorIntSet) that); } else { // really slow. optimize as needed. for (IntIterator it = intIterator(); it.hasNext();) { if (!that.contains(it.next())) { return false; } } return true; } }
@Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("null that"); } if (that instanceof SparseIntSet) { return isSubsetInternal((SparseIntSet) that); } else if (that instanceof BitVectorIntSet) { return isSubsetInternal((BitVectorIntSet) that); } else { // really slow. optimize as needed. for (IntIterator it = intIterator(); it.hasNext();) { if (!that.contains(it.next())) { return false; } } return true; } }
@Override public IntSet intersection(IntSet that) { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof SparseIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith((SparseIntSet) that); return temp; } else if (that instanceof BitVectorIntSet) { SparseIntSet s = ((BitVectorIntSet) that).toSparseIntSet(); MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(s); return temp; } else if (that instanceof MutableSharedBitVectorIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(that); return temp; } else { // this is really slow. optimize as needed. MutableSparseIntSet temp = MutableSparseIntSet.makeEmpty(); for (IntIterator it = intIterator(); it.hasNext();) { int x = it.next(); if (that.contains(x)) { temp.add(x); } } return temp; } }
@Override public IntSet intersection(IntSet that) { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof SparseIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith((SparseIntSet) that); return temp; } else if (that instanceof BitVectorIntSet) { SparseIntSet s = ((BitVectorIntSet) that).toSparseIntSet(); MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(s); return temp; } else if (that instanceof MutableSharedBitVectorIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(that); return temp; } else { // this is really slow. optimize as needed. MutableSparseIntSet temp = MutableSparseIntSet.makeEmpty(); for (IntIterator it = intIterator(); it.hasNext();) { int x = it.next(); if (that.contains(x)) { temp.add(x); } } return temp; } }
@Override public IntSet intersection(IntSet that) { if (that == null) { throw new IllegalArgumentException("that == null"); } if (that instanceof SparseIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith((SparseIntSet) that); return temp; } else if (that instanceof BitVectorIntSet) { SparseIntSet s = ((BitVectorIntSet) that).toSparseIntSet(); MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(s); return temp; } else if (that instanceof MutableSharedBitVectorIntSet) { MutableSparseIntSet temp = MutableSparseIntSet.make(this); temp.intersectWith(that); return temp; } else { // this is really slow. optimize as needed. MutableSparseIntSet temp = MutableSparseIntSet.makeEmpty(); for (IntIterator it = intIterator(); it.hasNext();) { int x = it.next(); if (that.contains(x)) { temp.add(x); } } return temp; } }