@Override public void run() { while (true) { testGarden.printList(testGarden.fruits); testGarden.printList(testGarden.vegetables); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }
private static void test1() { for (int i = 0; i < 5; i++) { testGarden.addFruit(i, "Fruit " + i); } testGarden.printList(testGarden.fruits); for (int i = 0; i < 5; i++) { testGarden.addVegetable(i, "Vegetable " + i); } testGarden.printList(testGarden.vegetables); testGarden.addFruit(7, "New Fruit 0"); testGarden.printList(testGarden.fruits); testGarden.addVegetable(3, "New Vegetable 0"); testGarden.addVegetable(5, "New Vegetable 1"); testGarden.printList(testGarden.vegetables); testGarden.removeFruit(10); testGarden.printList(testGarden.fruits); testGarden.removeVegetable(3); testGarden.printList(testGarden.vegetables); testGarden.removeVegetable(6); testGarden.printList(testGarden.vegetables); }