@Override public String toString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { sb.append(' ').append(vals[i]).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); sb.setCharAt(0, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
@Override public String toString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { sb.append(' ').append(vals[i]).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); sb.setCharAt(0, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
@Override public void forEach(Consumer<? super Integer> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { action.accept(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public boolean forEachWhile(IntPredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { if (!predicate.test(vals[i])) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }
@Override public boolean allContainingIn(IntCollection c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { if (!c.contains(vals[i])) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
@Override public boolean forEachWhile(IntPredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { if (!predicate.test(vals[i])) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }
@Override public boolean allContainingIn(IntCollection c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { if (!c.contains(vals[i])) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
@Override public boolean reverseRemoveAllFrom(IntSet s) { if (isEmpty() || s.isEmpty()) return false; boolean changed = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= s.removeInt(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean reverseAddAllTo(IntCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= c.add(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public void forEach(IntConsumer action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { action.accept(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public boolean reverseAddAllTo(IntCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= c.add(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean reverseRemoveAllFrom(IntSet s) { if (isEmpty() || s.isEmpty()) return false; boolean changed = false; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= s.removeInt(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public void forEach(Consumer<? super Integer> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { action.accept(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void forEach(IntConsumer action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); short free = freeValue; short[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { action.accept(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }