1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // main method to test the Recursion class // NOTE: I WILL do more testing than this!! You should add your own tests!! public class Tester { public static void main(String[] args) { Recursion list = new Recursion(); list.build(new String[]{"people", "eat", "crabs"}); list.print(); // people eat crabs System.out.println(); list.printInReverseOrder(); // crabs eat people System.out.println(); System.out.println(list.get(1)); // eat System.out.println(); System.out.println(list.longest()); // people System.out.println(); list.remove("people"); // people are removed list.print(); // eat crabs System.out.println(); list.duplicate(); list.print(); // eat eat crabs crabs System.out.println(); list.addSecond("sleep"); list.print(); // eat sleep eat crabs crabs } } |