boolean retainAll(@Nonnull HashObjSet<E> thisC, @Nonnull Collection<?> c) { if (thisC == c) throw new IllegalArgumentException(); if (isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
public int setHashCode() { int hashCode = 0; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { hashCode += nullableKeyHashCode(key); } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { hashCode += nullableKeyHashCode(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { result[resultIndex++] = key; } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { result[resultIndex++] = key; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public void forEach(Consumer<? super E> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { action.accept(key); } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != 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(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; sb.append(' ').append(key != this ? key : "(this Collection)").append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); sb.append(' ').append(key != this ? key : "(this Collection)").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 boolean removeIf(Predicate<? super E> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated;
public String setToString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; sb.append(' ').append(key != this ? key : "(this Collection)").append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); sb.append(' ').append(key != this ? key : "(this Collection)").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 boolean reverseAddAllTo(ObjCollection<? super E> c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { changed |= c.add(key); } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { 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(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { result[resultIndex++] = key; } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { result[resultIndex++] = key; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public int setHashCode() { int hashCode = 0; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { hashCode += nullableKeyHashCode(key); } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { hashCode += nullableKeyHashCode(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
boolean retainAll(@Nonnull HashObjSet<E> thisC, @Nonnull Collection<?> c) { if (thisC == c) throw new IllegalArgumentException(); if (isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
public boolean reverseAddAllTo(ObjCollection<? super E> c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { changed |= c.add(key); } } } else { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE && key != REMOVED) { changed |= c.add(key); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType(); int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex)
boolean removeAll(@Nonnull HashObjSet<E> thisC, @Nonnull Collection<?> c) { if (thisC == c) throw new IllegalArgumentException(); if (isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; incrementModCount(); mc++; tab[i] = REMOVED; postRemoveHook(); changed = true; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
public boolean allContainingIn(ObjCollection<?> c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); Object[] tab = table; if (noRemoved()) { for (int i = tab.length - 2; i >= 0; i -= 2) { E key; if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll;