Write test
This commit is contained in:
parent
404d0bd3b3
commit
7858b01653
@ -25,8 +25,6 @@ public class LinkedList {
|
||||
public void toNext() {
|
||||
if (hasAccess()) {
|
||||
current = current.getNextNode();
|
||||
} else {
|
||||
toFirst();
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,8 +65,8 @@ public class LinkedList {
|
||||
|
||||
newNode.setNextNode(current.getNextNode());
|
||||
current.setNextNode(newNode);
|
||||
size++;
|
||||
}
|
||||
size++;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
|
||||
28
Main.java
28
Main.java
@ -3,14 +3,26 @@ public class Main {
|
||||
Weapon weapon1 = new Weapon("dagger", 12);
|
||||
Weapon weapon2 = new Weapon("sword", 10);
|
||||
Weapon weapon3 = new Weapon("bow", 1);
|
||||
|
||||
Hero hero = new Hero("held", 12);
|
||||
/*
|
||||
hero.addWeapon(weapon1);
|
||||
hero.addWeapon(weapon2);
|
||||
hero.addWeapon(weapon3);
|
||||
|
||||
hero.chooseWeapon(weapon3);
|
||||
*/
|
||||
LinkedList linkedList = new LinkedList();
|
||||
System.out.println(linkedList.isEmpty());
|
||||
System.out.println(linkedList.hasAccess());
|
||||
System.out.println("Append:");
|
||||
linkedList.append(weapon1);
|
||||
System.out.println("Insert:");
|
||||
linkedList.insert(weapon2);
|
||||
System.out.println(linkedList.getSize());
|
||||
System.out.println(linkedList.hasAccess());
|
||||
System.out.println("Append:");
|
||||
linkedList.append(weapon3);
|
||||
|
||||
|
||||
linkedList.toFirst();
|
||||
linkedList.toLast();
|
||||
linkedList.toNext();
|
||||
System.out.println(linkedList.getFirst());
|
||||
System.out.println(linkedList.getLast());
|
||||
|
||||
linkedList.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user