@Override
    public Object[] toArray() {
        return toArray(new Object[size]);
    }
@Test
    public void testToGenericArrayReturnsNewArrayWhenSmallArrayProvided() {
        final OAHashSet<Integer> set = new OAHashSet<>(8);
        populateSet(set, 10);

        final Integer[] setElementsProvided = new Integer[9];
        final Object[] setElementsReturned = set.toArray(setElementsProvided);

        assertNotSame(setElementsProvided, setElementsReturned);

        final BitSet foundElements = new BitSet(10);
        for (Object foundElement : setElementsReturned) {
            foundElements.set((Integer) foundElement);
        }

        for (int i = 0; i < 10; i++) {
            assertTrue(foundElements.get(i));
        }
    }