LongHashSet extends AbstractSet<Long> implements Serializable { @SuppressWarnings("unchecked") @Override public <T> T[] toArray(final T[] a) { final Class<?> componentType = a.getClass().getComponentType(); if (!componentType.isAssignableFrom(Long.class)) { throw new ArrayStoreException("cannot store Longs in array of type " + componentType); } final int size = size(); final T[] arrayCopy = a.length >= size ? a : (T[]) Array.newInstance(componentType, size); copyValues(arrayCopy); return arrayCopy; } LongHashSet();  LongHashSet(final int proposedCapacity);  LongHashSet(final int proposedCapacity, final float loadFactor); float loadFactor(); int capacity(); int resizeThreshold(); @Override boolean add(final Long value); boolean add(final long value); @Override boolean remove(final Object value); boolean remove(final long value); void compact(); @Override boolean contains(final Object value); boolean contains(final long value); @Override int size(); @Override boolean isEmpty(); @Override void clear(); @Override boolean addAll(final Collection<? extends Long> coll); @Override boolean removeAll(final Collection<?> coll); @Override LongIterator iterator(); @Override String toString(); @SuppressWarnings("unchecked") @Override T[] toArray(final T[] a); @Override Object[] toArray(); boolean containsAll(final LongHashSet other); @Override boolean equals(final Object other); @Override int hashCode(); static final int DEFAULT_INITIAL_CAPACITY; static final float DEFAULT_LOAD_FACTOR; }
@SuppressWarnings("CollectionToArraySafeParameter") @Test(expected = ArrayStoreException.class) public void toArrayThrowsArrayStoreExceptionForWrongType() { testSet.toArray(new String[1]); }
@Test(expected = NullPointerException.class) public void toArrayThrowsNullPointerExceptionForNullArgument() { final Long[] into = null; testSet.toArray(into); }