### Question:
SafeArrayList extends CommonsArrayList <ELEMENTTYPE> { @Override public ELEMENTTYPE get (@Nonnegative final int nIndex) { _ensureSize (nIndex); return super.get (nIndex); } SafeArrayList();  SafeArrayList(@Nonnull final Supplier <? extends ELEMENTTYPE> aFactory); @Nonnull Supplier <? extends ELEMENTTYPE> getFactory(); @Override ELEMENTTYPE get(@Nonnegative final int nIndex); @Nullable ELEMENTTYPE computeIfAbsent(@Nonnegative final int nIndex, @Nonnull final Supplier <? extends ELEMENTTYPE> aFactory); @Override ELEMENTTYPE set(@Nonnegative final int nIndex, @Nonnull final ELEMENTTYPE aElement); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testSafeArrayListNullFactory () { final SafeArrayList <String> sv = new SafeArrayList <> (); assertEquals (0, sv.size ()); assertNull (sv.get (0)); assertEquals (1, sv.size ()); assertNull (sv.get (10)); assertEquals (11, sv.size ()); for (final String sMember : sv) assertNull (sMember); }
@SuppressWarnings ("unused") @Test public void testSafeArrayListNewInstanceFactory () { try { new SafeArrayList <String> (null); fail (); } catch (final NullPointerException ex) {} final SafeArrayList <String> sv = new SafeArrayList <> (FactoryNewInstance.create (String.class)); assertEquals (0, sv.size ()); assertNotNull (sv.get (0)); assertEquals (1, sv.size ()); assertNotNull (sv.get (10)); assertEquals (11, sv.size ()); for (final String sMember : sv) assertNotNull (sMember); }