Returns a new array containing all elements contained in this LinkedList. @return an array of the elements from this LinkedList.
()
| 726 | * @return an array of the elements from this {@code LinkedList}. |
| 727 | */ |
| 728 | @Override |
| 729 | public Object[] toArray() { |
| 730 | int index = 0; |
| 731 | Object[] contents = new Object[size]; |
| 732 | Link<E> link = voidLink.next; |
| 733 | while (link != voidLink) { |
| 734 | contents[index++] = link.data; |
| 735 | link = link.next; |
| 736 | } |
| 737 | return contents; |
| 738 | } |
| 739 | |
| 740 | /** |
| 741 | * Returns an array containing all elements contained in this |
nothing calls this directly
no test coverage detected