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));
@SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType();
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));
@SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType();
@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; }
@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; }