public void forEach(Consumer<? super E> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { action.accept(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
public int setHashCode() { int hashCode = 0; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { 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; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public String setToString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { 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, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
public ObjCursor<E> setCursor() { int mc = modCount(); return new NoRemovedCursor(mc); }
public String setToString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { 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, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
public ObjIterator<E> iterator() { int mc = modCount(); return new NoRemovedIterator(mc); }
public boolean reverseAddAllTo(ObjCollection<? super E> c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; 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); } } 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; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { 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; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { hashCode += nullableKeyHashCode(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
public ObjCursor<E> setCursor() { int mc = modCount(); return new NoRemovedCursor(mc); }
public boolean reverseAddAllTo(ObjCollection<? super E> c) { if (isEmpty()) return false; boolean changed = false; int mc = modCount(); Object[] tab = table; 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); } } 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(); a = (T[]) java.lang.reflect.Array.newInstance(elementType, size); } if (size == 0) { if (a.length > 0) a[0] = null; return a; } int resultIndex = 0; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { a[resultIndex++] = (T) key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
public ObjIterator<E> iterator() { int mc = modCount(); return new NoRemovedIterator(mc); }
public void forEach(Consumer<? super E> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { action.accept(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType(); a = (T[]) java.lang.reflect.Array.newInstance(elementType, size); } if (size == 0) { if (a.length > 0) a[0] = null; return a; } int resultIndex = 0; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { a[resultIndex++] = (T) key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
public boolean forEachWhile( Predicate<? super E> predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { if (!predicate.test(key)) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }
public boolean allContainingIn(ObjCollection<?> c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { if (!c.contains(key)) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
public boolean allContainingIn(ObjCollection<?> c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { if (!c.contains(key)) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
public boolean forEachWhile( Predicate<? super E> predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); Object[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { E key; // noinspection unchecked if ((key = (E) (E) tab[i]) != FREE) { if (!predicate.test(key)) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }