### Question:
LightWeightLinkedSet extends LightWeightHashSet<T> { @Override @SuppressWarnings("unchecked") public <U> U[] toArray(U[] a) { if (a == null) { throw new NullPointerException("Input array can not be null"); } if (a.length < size) { a = (U[]) java.lang.reflect.Array.newInstance(a.getClass() .getComponentType(), size); } int currentIndex = 0; DoubleLinkedElement<T> current = head; while (current != null) { T curr = current.element; a[currentIndex++] = (U) curr; current = current.after; } return a; } LightWeightLinkedSet(int initCapacity, float maxLoadFactor,
      float minLoadFactor);  LightWeightLinkedSet(); T pollFirst(); @Override List<T> pollN(int n); @Override List<T> pollAll(); @Override @SuppressWarnings("unchecked") U[] toArray(U[] a); @Override Iterator<T> iterator(); @Override void clear();  }### Answer:
@Test public void testOther() { LOG.info("Test other"); assertTrue(set.addAll(list)); Integer[] array = set.toArray(new Integer[0]); assertEquals(NUM, array.length); for (int i = 0; i < array.length; i++) { assertTrue(list.contains(array[i])); } assertEquals(NUM, set.size()); Object[] array2 = set.toArray(); assertEquals(NUM, array2.length); for (int i = 0; i < array2.length; i++) { assertTrue(list.contains((Integer) array2[i])); } LOG.info("Test capacity - DONE"); }
@Test public void testOther() { LOG.info("Test other"); assertTrue(set.addAll(list)); Integer[] array = set.toArray(new Integer[0]); assertEquals(NUM, array.length); for (int i = 0; i < array.length; i++) { assertTrue(list.contains(array[i])); } assertEquals(NUM, set.size()); Object[] array2 = set.toArray(); assertEquals(NUM, array2.length); for (int i = 0; i < array2.length; i++) { assertTrue(list.contains(array2[i])); } LOG.info("Test capacity - DONE"); }