/** Moo */ @Test public void testToArray() { words.add("5"); words.add("6"); words.add("7"); Object[] vals = words.toArray(); assertEquals("5", vals[0]); assertEquals("6", vals[1]); assertEquals("7", vals[2]); assertEquals(3, vals.length); }
/** * Return all hashed values as an hashMap * * @return hashed values in hashMap */ @WrittenWhile("Caffeine levels dangerously low.") public T[] toArray() { MyArrayList<T> result = new MyArrayList<>(); for (MyLinkedList<Tuple<T>> list : hashed) { int j = 0; while (list.get(j) != null) { result.add(list.get(j).getValue().value); j++; } } return result.toArray(1); }