boolean retainAll(@Nonnull HashByteSet thisC, @Nonnull Collection<?> c) { if (c instanceof ByteCollection) return retainAll(thisC, (ByteCollection) c); if (thisC == c) throw new IllegalArgumentException(); if (isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { if (!c.contains(key)) { incrementModCount(); mc++; U.putByte(tab, base + off, removed); postRemoveHook(); changed = true; if ((key = U.getByte(tab, base + off)) != free && key != removed) { if (!c.contains(key)) { incrementModCount();
@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result;
@Override public void remove() { byte free; if (curKey != (free = this.free)) { if (expectedModCount++ == modCount()) { this.curKey = free; incrementModCount(); U.putByte(tab, CHAR_BASE + BYTE_KEY_OFFSET + (((long) (index)) << CHAR_SCALE_SHIFT), removed); postRemoveHook(); } else { throw new java.util.ConcurrentModificationException(); } } else { throw new java.lang.IllegalStateException(); } } }
public int setHashCode() { int hashCode = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { hashCode += key; } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { hashCode += key; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
public void forEach(Consumer<? super Byte> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { action.accept(key); } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { action.accept(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
public String setToString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; sb.append(' ').append(key).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); 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, '[');
@Override public boolean moveNext() { if (expectedModCount == modCount()) { char[] tab = this.tab; byte free = this.free; byte removed = this.removed; int entry; for (int i = index - 1; i >= 0; i--) { byte key; if ((key = (byte) (entry = tab[i])) != free && key != removed) { index = i; curKey = key; return true; } } curKey = free; index = -1; return false; } else { throw new java.util.ConcurrentModificationException(); } }
public boolean removeIf(Predicate<? super Byte> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (isEmpty()) return false; boolean changed = false; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { if (filter.test(key)) { incrementModCount(); mc++; U.putByte(tab, base + off, removed); postRemoveHook(); changed = true; if ((key = U.getByte(tab, base + off)) != free && key != removed) { if (filter.test(key)) { incrementModCount(); mc++; U.putByte(tab, base + off, removed); postRemoveHook(); changed = true;
public void forEach(ByteConsumer action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { action.accept(key); } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { action.accept(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void remove() { int index; if ((index = this.index) >= 0) { if (expectedModCount++ == modCount()) { this.index = -1; incrementModCount(); U.putByte(tab, CHAR_BASE + BYTE_KEY_OFFSET + (((long) (index)) << CHAR_SCALE_SHIFT), removed); postRemoveHook(); } else { throw new java.util.ConcurrentModificationException(); } } else { throw new java.lang.IllegalStateException(); } } }
public String setToString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; sb.append(' ').append(key).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); 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, '[');
public int setHashCode() { int hashCode = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { hashCode += key; } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { hashCode += key; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public boolean moveNext() { if (expectedModCount == modCount()) { char[] tab = this.tab; byte free = this.free; int entry; for (int i = index - 1; i >= 0; i--) { byte key; if ((key = (byte) (entry = tab[i])) != free) { index = i; curKey = key; return true; } } curKey = free; index = -1; return false; } else { throw new java.util.ConcurrentModificationException(); } }
public boolean removeIf(BytePredicate filter) { if (filter == null) throw new java.lang.NullPointerException(); if (isEmpty()) return false; boolean changed = false; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { if (filter.test(key)) { incrementModCount(); mc++; U.putByte(tab, base + off, removed); postRemoveHook(); changed = true; if ((key = U.getByte(tab, base + off)) != free && key != removed) { if (filter.test(key)) { incrementModCount(); mc++; U.putByte(tab, base + off, removed); postRemoveHook(); changed = true;
public boolean reverseAddAllTo(ByteCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { changed |= c.add(key); } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { changed |= c.add(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public void remove() { int index; if ((index = this.index) >= 0) { if (expectedModCount++ == modCount()) { this.index = -1; incrementModCount(); U.putByte(tab, CHAR_BASE + BYTE_KEY_OFFSET + (((long) (index)) << CHAR_SCALE_SHIFT), removed); postRemoveHook(); } else { throw new java.util.ConcurrentModificationException(); } } else { throw new java.lang.IllegalStateException(); } } }
@Nonnull public byte[] toByteArray() { int size = size(); byte[] result = new byte[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result;
@Override public boolean moveNext() { if (expectedModCount == modCount()) { char[] tab = this.tab; byte free = this.free; int entry; for (int i = index - 1; i >= 0; i--) { byte key; if ((key = (byte) (entry = tab[i])) != free) { index = i; curKey = key; return true; } } curKey = free; index = -1; return false; } else { throw new java.util.ConcurrentModificationException(); } }
public boolean reverseAddAllTo(ByteCollection c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); byte free = freeValue; byte removed = removedValue; char[] tab = table; long base = CHAR_BASE + BYTE_KEY_OFFSET; if (noRemoved()) { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free) { changed |= c.add(key); } } } else { for (long off = ((long) tab.length) << CHAR_SCALE_SHIFT; (off -= CHAR_SCALE) >= 0L;) { byte key; if ((key = U.getByte(tab, base + off)) != free && key != removed) { changed |= c.add(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }