### Question:
KTypeArrayList extends AbstractKTypeCollection<KType> implements KTypeIndexedContainer<KType>,
             Preallocable,
             Cloneable,
             Accountable { @Override public Object [] toArray() { return Arrays.copyOf(buffer, elementsCount); } KTypeArrayList();  KTypeArrayList(int expectedElements);  KTypeArrayList(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayList(KTypeContainer<? extends KType> container); @Override void add(KType e1); void add(KType e1, KType e2); void add(KType[] elements, int start, int length); @SafeVarargs /* #end */ final void add(KType... elements); int addAll(KTypeContainer<? extends KType> container); int addAll(Iterable<? extends KTypeCursor<? extends KType>> iterable); @Override void insert(int index, KType e1); @Override KType get(int index); @Override KType set(int index, KType e1); @Override KType remove(int index); @Override void removeRange(int fromIndex, int toIndex); @Override int removeFirst(KType e1); @Override int removeLast(KType e1); @Override int removeAll(KType e1); @Override boolean contains(KType e1); @Override int indexOf(KType e1); @Override int lastIndexOf(KType e1); @Override boolean isEmpty(); @Override void ensureCapacity(int expectedElements); void resize(int newSize); @Override int size(); void trimToSize(); @Override void clear(); @Override void release(); @Override /*! #if ($TemplateOptions.KTypePrimitive) KType [] toArray() #else !*/ Object [] toArray(); @Override KTypeArrayList<KType> clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override long ramBytesAllocated(); @Override long ramBytesUsed(); @Override Iterator<KTypeCursor<KType>> iterator(); @Override T forEach(T procedure); T forEach(T procedure, int fromIndex, final int toIndex); @Override int removeAll(KTypePredicate<? super KType> predicate); @Override T forEach(T predicate); T forEach(T predicate, int fromIndex, final int toIndex); @SafeVarargs /* #end */ static KTypeArrayList<KType> from(KType... elements); final static Object [] EMPTY_ARRAY; public Object [] buffer; public int elementsCount; }### Answer:
@Test public void testToArray() { KTypeArrayList<KType> l1 = KTypeArrayList.from(k1, k2, k3); Object[] result = l1.toArray(); assertArrayEquals(new Object [] {k1, k2, k3}, result); }