@Override public String toString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(); long free = freeValue; long[] keys = set; short[] 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 Short> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortPredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortCollection c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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 allContainingIn(ShortCollection c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortPredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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 reverseRemoveAllFrom(ShortSet s) { if (isEmpty() || s.isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= s.removeShort(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean reverseAddAllTo(ShortCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortSet s) { if (isEmpty() || s.isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] != free) { changed |= s.removeShort(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public void forEach(ShortConsumer action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(); }
public void forEach(Consumer<? super Short> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(ShortConsumer action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; short[] 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(); }