コード例 #1
0
  public void testAddElements(int size) {
    List<Integer> src = makeRandomNumberList(size);
    SinglyLinkedList l = new SinglyLinkedList();
    copy(src, l);

    ListIterator it = src.listIterator(src.size());
    while (it.hasPrevious()) assertEquals(it.previous(), l.pop_back());
  }
コード例 #2
0
 private static void copy(List<Integer> from, SinglyLinkedList to) {
   for (Integer n : from) to.push_back(n);
 }