/** * @return true iff {@code this} is a subset of {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() > that.size()) { return false; } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } if (densePart != null) { for (int b = densePart.nextSetBit(0); b != -1; b = densePart.nextSetBit(b + 1)) { if (!that.contains(b)) { return false; } } } return true; }
/** * @return true iff {@code this} has the same value as {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean sameValue(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() != that.size()) { return false; } if (densePart != null) { for (int bit = densePart.nextSetBit(0); bit != -1; bit = densePart.nextSetBit(bit + 1)) { if (!that.contains(bit)) { return false; } } } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } return true; }
/** * @return true iff {@code this} has the same value as {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean sameValue(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() != that.size()) { return false; } if (densePart != null) { for (int bit = densePart.nextSetBit(0); bit != -1; bit = densePart.nextSetBit(bit + 1)) { if (!that.contains(bit)) { return false; } } } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } return true; }
/** * @return true iff {@code this} has the same value as {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean sameValue(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() != that.size()) { return false; } if (densePart != null) { for (int bit = densePart.nextSetBit(0); bit != -1; bit = densePart.nextSetBit(bit + 1)) { if (!that.contains(bit)) { return false; } } } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } return true; }
/** * @return true iff {@code this} is a subset of {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() > that.size()) { return false; } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } if (densePart != null) { for (int b = densePart.nextSetBit(0); b != -1; b = densePart.nextSetBit(b + 1)) { if (!that.contains(b)) { return false; } } } return true; }
/** * @return true iff {@code this} is a subset of {@code that}. * @throws IllegalArgumentException if that is null */ @Override public boolean isSubset(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } if (size() > that.size()) { return false; } for (IntIterator bits = sparsePart.intIterator(); bits.hasNext();) { if (!that.contains(bits.next())) { return false; } } if (densePart != null) { for (int b = densePart.nextSetBit(0); b != -1; b = densePart.nextSetBit(b + 1)) { if (!that.contains(b)) { return false; } } } return true; }