public void forEach(Consumer<? super Long> action) { if (action == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { action.accept(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Nonnull public long[] toLongArray() { int size = size(); long[] result = new long[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public boolean removeIf(Predicate<? super Long> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; if ((key = keys[i]) != free) { if (filter.test(key)) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = delayedRemoved; closeDelayedRemoved(firstDelayedRemoved, delayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
long free; if ((curKey = this.curKey) != (free = this.free)) { if (expectedModCount++ == modCount()) { this.curKey = free; int index = this.index; if (keys == set) { int capacityMask = this.capacityMask; incrementModCount(); int indexToRemove = index; int indexToShift = indexToRemove; postRemoveHook(); } else { justRemove(curKey);
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { sb.append(' ').append(key).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(); }
public int setHashCode() { int hashCode = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { hashCode += ((int) (key ^ (key >>> 32))); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public void clear() { int mc = modCount() + 1; super.clear(); if (mc != modCount()) throw new ConcurrentModificationException(); } }
boolean retainAll(@Nonnull HashLongSet thisC, @Nonnull Collection<?> c) { if (c instanceof LongCollection) return retainAll(thisC, (LongCollection) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); long free = freeValue; long[] keys = set; if ((key = keys[i]) != free) { if (!c.contains(key)) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = delayedRemoved; closeDelayedRemoved(firstDelayedRemoved, delayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
int index; if ((index = this.index) >= 0) { if (expectedModCount++ == modCount()) { this.index = -1; long[] keys = this.keys; if (keys == set) { int capacityMask = this.capacityMask; incrementModCount(); int indexToRemove = index; int indexToShift = indexToRemove; postRemoveHook(); } else { justRemove(keys[index]);
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { sb.append(' ').append(key).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(); }
public int setHashCode() { int hashCode = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { hashCode += ((int) (key ^ (key >>> 32))); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public void clear() { int mc = modCount() + 1; super.clear(); if (mc != modCount()) throw new ConcurrentModificationException(); } }
boolean retainAll(@Nonnull HashLongSet thisC, @Nonnull Collection<?> c) { if (c instanceof LongCollection) return retainAll(thisC, (LongCollection) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); long free = freeValue; long[] keys = set; if ((key = keys[i]) != free) { if (!c.contains(key)) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = delayedRemoved; closeDelayedRemoved(firstDelayedRemoved, delayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
long free; if ((curKey = this.curKey) != (free = this.free)) { if (expectedModCount++ == modCount()) { this.curKey = free; int index = this.index; if (keys == set) { int capacityMask = this.capacityMask; incrementModCount(); int indexToRemove = index; int indexToShift = indexToRemove; postRemoveHook(); } else { justRemove(curKey);
public boolean reverseAddAllTo(LongCollection c) { if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { changed |= c.add(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long free = freeValue; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Override public boolean moveNext() { if (expectedModCount == modCount()) { long[] keys = this.keys; long free = this.free; for (int i = index - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { index = i; curKey = key; return true; } } curKey = free; index = -1; return false; } else { throw new java.util.ConcurrentModificationException(); } }
public boolean removeIf(Predicate<? super Long> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long free = freeValue; long[] keys = set; if ((key = keys[i]) != free) { if (filter.test(key)) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = delayedRemoved; closeDelayedRemoved(firstDelayedRemoved, delayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;