@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Nonnull public short[] toShortArray() { int size = size(); short[] result = new short[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@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(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { a[resultIndex++] = (T) Short.valueOf(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
@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(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { a[resultIndex++] = (T) Short.valueOf(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short 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(); }
@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Nonnull public short[] toShortArray() { int size = size(); short[] result = new short[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { result[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short 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(); }
@Nonnull public short[] toArray(short[] a) { int size = size(); if (a.length < size) a = new short[size]; if (size == 0) { if (a.length > 0) a[0] = (short) 0; return a; } int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { a[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = (short) 0; return a; }
@Nonnull public short[] toArray(short[] a) { int size = size(); if (a.length < size) a = new short[size]; if (size == 0) { if (a.length > 0) a[0] = (short) 0; return a; } int resultIndex = 0; int mc = modCount(); short free = freeValue; short[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { short key; if ((key = keys[i]) != free) { a[resultIndex++] = key; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = (short) 0; return a; }