public IntIterator iterateIndices() { return indices.intIterator(); }
public IntIterator iterateIndices() { return indices.intIterator(); }
public IntIterator iterateIndices() { return indices.intIterator(); }
/** * This iteration _will_ cover all indices even when remove is called while * the iterator is active. */ public IntIterator safeIterateIndices() { return MutableSparseIntSet.make(indices).intIterator(); }
/** * This iteration _will_ cover all indices even when remove is called while * the iterator is active. */ public IntIterator safeIterateIndices() { return MutableSparseIntSet.make(indices).intIterator(); }
/** * This iteration _will_ cover all indices even when remove is called while * the iterator is active. */ public IntIterator safeIterateIndices() { return MutableSparseIntSet.make(indices).intIterator(); }
@Override public IntIterator intIterator() { if (privatePart == null) { return (sharedPart == null) ? EmptyIntIterator.instance() : sharedPart.intIterator(); } else { return (sharedPart == null) ? privatePart.intIterator() : new CompoundIntIterator(privatePart.intIterator(), sharedPart .intIterator()); } }
@Override public IntIterator intIterator() { if (privatePart == null) { return (sharedPart == null) ? EmptyIntIterator.instance() : sharedPart.intIterator(); } else { return (sharedPart == null) ? privatePart.intIterator() : new CompoundIntIterator(privatePart.intIterator(), sharedPart .intIterator()); } }
@Override public IntIterator intIterator() { if (privatePart == null) { return (sharedPart == null) ? EmptyIntIterator.instance() : sharedPart.intIterator(); } else { return (sharedPart == null) ? privatePart.intIterator() : new CompoundIntIterator(privatePart.intIterator(), sharedPart .intIterator()); } }
/** * TODO optimize * * @throws IllegalArgumentException * if set is null */ public void removeAll(MutableSparseIntSet set) { if (set == null) { throw new IllegalArgumentException("set is null"); } for (IntIterator it = set.intIterator(); it.hasNext();) { remove(it.next()); } }
/** * TODO optimize * * @throws IllegalArgumentException * if set is null */ public void removeAll(MutableSparseIntSet set) { if (set == null) { throw new IllegalArgumentException("set is null"); } for (IntIterator it = set.intIterator(); it.hasNext();) { remove(it.next()); } }
/** * TODO optimize * * @throws IllegalArgumentException * if set is null */ public void removeAll(MutableSparseIntSet set) { if (set == null) { throw new IllegalArgumentException("set is null"); } for (IntIterator it = set.intIterator(); it.hasNext();) { remove(it.next()); } }
private final boolean assertDisjoint() { if (DEBUG) { if (densePart != null) { for (IntIterator sparseBits = sparsePart.intIterator(); sparseBits.hasNext();) { int bit = sparseBits.next(); if (densePart.contains(bit)) { return false; } if (inDenseRange(bit)) { return false; } } } } return true; }
private final boolean assertDisjoint() { if (DEBUG) { if (densePart != null) { for (IntIterator sparseBits = sparsePart.intIterator(); sparseBits.hasNext();) { int bit = sparseBits.next(); if (densePart.contains(bit)) { return false; } if (inDenseRange(bit)) { return false; } } } } return true; }
private final boolean assertDisjoint() { if (DEBUG) { if (densePart != null) { for (IntIterator sparseBits = sparsePart.intIterator(); sparseBits.hasNext();) { int bit = sparseBits.next(); if (densePart.contains(bit)) { return false; } if (inDenseRange(bit)) { 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} 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; }