update,
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
public interface Comparator {
|
||||
public abstract boolean isEqualTo(Object item1, Object item2);
|
||||
public abstract boolean isLessThan(Object item1, Object item2);
|
||||
public abstract boolean isLessThanOrEqualTo(Object item1, Object item2);
|
||||
public abstract boolean isGreaterThan(Object item1, Object item2);
|
||||
public abstract boolean isGreaterThanOrEqualTo(Object item1, Object item2);
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
public class ComparatorLinkedList extends LinkedList {
|
||||
|
||||
Comparator comparator;
|
||||
|
||||
ComparatorLinkedList(Comparator comparator) {
|
||||
super();
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
public void removeItem(Object item) throws ItemNotFoundException, EmptyListException {
|
||||
if (isEmpty()) {
|
||||
throw new ItemNotFoundException();
|
||||
}
|
||||
if (comparator.isEqualTo(head.data, item)) {
|
||||
removeFromHead();
|
||||
} else if (comparator.isEqualTo(tail.data, item)) {
|
||||
removeFromTail();
|
||||
} else {
|
||||
ListNode current = head;
|
||||
while (current.next != null) {
|
||||
if (comparator.isEqualTo(current.next.data, item)) {
|
||||
current.next = current.next.next;
|
||||
return;
|
||||
}
|
||||
current = current.next;
|
||||
}
|
||||
throw new EmptyListException();
|
||||
}
|
||||
}
|
||||
|
||||
public void insertInOrder(Object item) {
|
||||
if (isEmpty()) {
|
||||
head = tail = new ListNode(item);
|
||||
} else {
|
||||
if (comparator.isGreaterThanOrEqualTo(head.data, item)) {
|
||||
addToHead(item);
|
||||
} else if (comparator.isLessThanOrEqualTo(tail.data, item)) {
|
||||
addToTail(item);
|
||||
} else {
|
||||
ListNode current = head;
|
||||
while (current.next != null) {
|
||||
if (comparator.isGreaterThanOrEqualTo(current.next.data, item)) {
|
||||
ListNode newNode = new ListNode(item);
|
||||
newNode.next = current.next;
|
||||
current.next = newNode;
|
||||
return;
|
||||
}
|
||||
current = current.next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
80
_resources/it114105/itp4510/Lab03/Lab3.1/src/DoublyList.java
Normal file
80
_resources/it114105/itp4510/Lab03/Lab3.1/src/DoublyList.java
Normal file
@@ -0,0 +1,80 @@
|
||||
public class DoublyList {
|
||||
private DoublyNode head;
|
||||
private DoublyNode tail;
|
||||
|
||||
public DoublyList() {
|
||||
head = tail = null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (head == null);
|
||||
}
|
||||
|
||||
public void addToHead(Object item) {
|
||||
if (isEmpty()) {
|
||||
head = tail = new DoublyNode(item);
|
||||
} else {
|
||||
head.previous = new DoublyNode(item, null, head);
|
||||
head = head.previous;
|
||||
}
|
||||
}
|
||||
|
||||
public void addToTail(Object item) {
|
||||
if (isEmpty()) {
|
||||
head = tail = new DoublyNode(item);
|
||||
} else {
|
||||
tail.next = new DoublyNode(item, tail, null);
|
||||
tail = tail.next;
|
||||
}
|
||||
}
|
||||
|
||||
public Object removeFromHead() throws EmptyListException {
|
||||
if (isEmpty()) {
|
||||
throw new EmptyListException();
|
||||
}
|
||||
Object item = head.data;
|
||||
if (head == tail) {
|
||||
head = tail = null;
|
||||
} else {
|
||||
head = head.next;
|
||||
head.previous = null;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public Object removeFromTail() throws EmptyListException {
|
||||
if (isEmpty()) {
|
||||
throw new EmptyListException();
|
||||
}
|
||||
Object item = tail.data;
|
||||
if (head == tail) {
|
||||
head = tail = null;
|
||||
} else {
|
||||
tail = tail.previous;
|
||||
tail.next = null;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
public String toString(){
|
||||
String s ="[";
|
||||
DoublyNode current = head;
|
||||
while(current!=null){
|
||||
s+=current.data + " ";
|
||||
current = current.next;
|
||||
}
|
||||
return s + "]";
|
||||
}
|
||||
public String forward(){
|
||||
return toString();
|
||||
}
|
||||
|
||||
public String backward(){
|
||||
String s = "[";
|
||||
DoublyNode current =tail;
|
||||
while(current != null){
|
||||
s+= current.data + " ";
|
||||
current = current.previous;
|
||||
}
|
||||
return s+ "]";
|
||||
}
|
||||
}
|
19
_resources/it114105/itp4510/Lab03/Lab3.1/src/DoublyNode.java
Normal file
19
_resources/it114105/itp4510/Lab03/Lab3.1/src/DoublyNode.java
Normal file
@@ -0,0 +1,19 @@
|
||||
public class DoublyNode {
|
||||
|
||||
Object data;
|
||||
DoublyNode previous;
|
||||
DoublyNode next;
|
||||
|
||||
DoublyNode(Object data){
|
||||
this.data = data;
|
||||
previous = next = null;
|
||||
}
|
||||
|
||||
DoublyNode(Object data, DoublyNode previous, DoublyNode next){
|
||||
this.data = data;
|
||||
this.previous = previous;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
public class EmptyListException extends Exception{
|
||||
EmptyListException(){
|
||||
super();
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
public class ItemNotFoundException extends Exception {
|
||||
ItemNotFoundException(){
|
||||
super();
|
||||
}
|
||||
}
|
158
_resources/it114105/itp4510/Lab03/Lab3.1/src/LinkedList.java
Normal file
158
_resources/it114105/itp4510/Lab03/Lab3.1/src/LinkedList.java
Normal file
@@ -0,0 +1,158 @@
|
||||
public class LinkedList {
|
||||
ListNode head;
|
||||
ListNode tail;
|
||||
int count = 0;
|
||||
|
||||
LinkedList(){
|
||||
head = null;
|
||||
tail = null;
|
||||
}
|
||||
|
||||
public int getCount(){
|
||||
return count;
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
return (head == null && tail == null);
|
||||
}
|
||||
|
||||
public void addToHead(Object data){
|
||||
ListNode node = new ListNode(data);
|
||||
if(isEmpty()){
|
||||
head = tail = node;
|
||||
count++;
|
||||
return;
|
||||
}
|
||||
node.next = head;
|
||||
head = node;
|
||||
count++;
|
||||
}
|
||||
|
||||
public void addToTail(Object data){
|
||||
ListNode node = new ListNode(data);
|
||||
if(isEmpty()){
|
||||
head = tail = node;
|
||||
count++;
|
||||
return;
|
||||
}
|
||||
tail.next = node;
|
||||
tail = node;
|
||||
count++;
|
||||
}
|
||||
|
||||
public Object removeFromHead(){
|
||||
if(isEmpty())
|
||||
throw new IndexOutOfBoundsException();
|
||||
ListNode node = head;
|
||||
|
||||
if(tail == head){
|
||||
head = tail = null;
|
||||
count--;
|
||||
return node.data;
|
||||
}
|
||||
|
||||
head = head.next;
|
||||
count--;
|
||||
return node.data;
|
||||
}
|
||||
|
||||
public Object removeFromTail(){
|
||||
if(isEmpty())
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
||||
ListNode node = tail;
|
||||
|
||||
if(tail == head){
|
||||
head = tail = null;
|
||||
count--;
|
||||
return node.data;
|
||||
}
|
||||
ListNode currentNode = head;
|
||||
while(currentNode.next != tail){
|
||||
currentNode = currentNode.next;
|
||||
System.out.println(currentNode.data);
|
||||
}
|
||||
currentNode.next = null;
|
||||
tail = currentNode;
|
||||
count--;
|
||||
return node.data;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
ListNode currentNode = head;
|
||||
String listData = "";
|
||||
while (currentNode != null){
|
||||
listData += currentNode.data + " ";
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
return listData;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
head = tail = null;
|
||||
}
|
||||
|
||||
public Object getItemAt(int n){
|
||||
if (n < 0 || n >= count)
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
||||
int currentPos = 0;
|
||||
ListNode currentNode = head;
|
||||
while(currentPos < n){
|
||||
if(count == currentPos)
|
||||
break;
|
||||
currentNode = currentNode.next;
|
||||
currentPos++;
|
||||
}
|
||||
|
||||
return currentNode.data;
|
||||
}
|
||||
|
||||
public Object removeItemAt(int n){
|
||||
if (n < 0 || n >= count)
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
||||
int currentPos = 0;
|
||||
ListNode currentNode = head;
|
||||
|
||||
if(n==0){
|
||||
removeFromHead();
|
||||
return currentNode.data;
|
||||
}
|
||||
|
||||
while(currentPos < n-1){
|
||||
currentNode = currentNode.next;
|
||||
currentPos++;
|
||||
}
|
||||
|
||||
ListNode item = currentNode.next;
|
||||
currentNode.next = currentNode.next.next;
|
||||
count--;
|
||||
return item.data;
|
||||
}
|
||||
|
||||
|
||||
public void addItemAt(Object item, int n){
|
||||
if (n > count)
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
||||
|
||||
if (isEmpty() || n == 0){
|
||||
addToHead(item);
|
||||
return;
|
||||
}
|
||||
|
||||
ListNode node = new ListNode(item);
|
||||
int currentPos = 0;
|
||||
ListNode currentNode = head;
|
||||
while(currentPos < n-1){
|
||||
currentNode = currentNode.next;
|
||||
currentPos++;
|
||||
}
|
||||
|
||||
node.next = currentNode.next;
|
||||
currentNode.next = node;
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
14
_resources/it114105/itp4510/Lab03/Lab3.1/src/ListNode.java
Normal file
14
_resources/it114105/itp4510/Lab03/Lab3.1/src/ListNode.java
Normal file
@@ -0,0 +1,14 @@
|
||||
public class ListNode {
|
||||
Object data;
|
||||
ListNode next;
|
||||
|
||||
ListNode(Object data, ListNode next){
|
||||
this.data = data;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
ListNode(Object data){
|
||||
this.data = data;
|
||||
this.next = null;
|
||||
}
|
||||
}
|
17
_resources/it114105/itp4510/Lab03/Lab3.1/src/Person.java
Normal file
17
_resources/it114105/itp4510/Lab03/Lab3.1/src/Person.java
Normal file
@@ -0,0 +1,17 @@
|
||||
public class Person {
|
||||
private String name;
|
||||
private int age;
|
||||
|
||||
public Person(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "(" + name + ", " + age + ")";
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
public class PersonComparator implements Comparator {
|
||||
|
||||
public boolean isEqualTo(Object item1, Object item2) {
|
||||
return (((Person) item1).getAge()==((Person) item2).getAge());
|
||||
}
|
||||
|
||||
|
||||
public boolean isLessThan(Object item1, Object item2) {
|
||||
return (((Person) item1).getAge()<((Person) item2).getAge());
|
||||
}
|
||||
|
||||
|
||||
public boolean isLessThanOrEqualTo(Object item1, Object item2) {
|
||||
return(isLessThan(item1, item2) || isEqualTo(item1, item2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean isGreaterThan(Object item1, Object item2) {
|
||||
return (((Person) item1).getAge()>((Person) item2).getAge());
|
||||
}
|
||||
|
||||
|
||||
public boolean isGreaterThanOrEqualTo(Object item1, Object item2) {
|
||||
return (isGreaterThan(item1, item2) || isEqualTo(item1, item2));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
public class StringComparator implements Comparator{
|
||||
public boolean isEqualTo(Object item1, Object item2) {
|
||||
return ((String) item1).compareTo((String) item2) == 0;
|
||||
|
||||
}
|
||||
|
||||
public boolean isLessThan(Object item1, Object item2) {
|
||||
return((String) item1).compareTo((String) item2) < 0;
|
||||
}
|
||||
|
||||
public boolean isLessThanOrEqualTo(Object item1, Object item2) {
|
||||
return (isEqualTo(item1, item2) || isLessThan(item1, item2));
|
||||
}
|
||||
|
||||
public boolean isGreaterThan(Object item1, Object item2) {
|
||||
return (((String) item1).compareTo((String) item2) > 0);
|
||||
}
|
||||
|
||||
public boolean isGreaterThanOrEqualTo(Object item1, Object item2) {
|
||||
return (isEqualTo(item1, item2) || isGreaterThan(item1, item2));
|
||||
}
|
||||
}
|
45
_resources/it114105/itp4510/Lab03/Lab3.1/src/Test.java
Normal file
45
_resources/it114105/itp4510/Lab03/Lab3.1/src/Test.java
Normal file
@@ -0,0 +1,45 @@
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
LinkedList s = new LinkedList();
|
||||
System.out.println(s);
|
||||
s.addToHead("Betty");
|
||||
s.addToTail("Dave");
|
||||
s.addToTail("Felix");
|
||||
s.addToTail("Jenny");
|
||||
System.out.println(s);
|
||||
System.out.println("count = " + s.getCount());
|
||||
System.out.println("Pos 0 = " + s.getItemAt(0));
|
||||
System.out.println("Pos 2 = " + s.getItemAt(2));
|
||||
System.out.println("Last = " + s.getItemAt(s.getCount() - 1));
|
||||
s.addItemAt("Gary", 3);
|
||||
System.out.println(s);
|
||||
s.addItemAt("Apple", 0);
|
||||
System.out.println(s);
|
||||
System.out.println("Removing " + s.removeItemAt(2));
|
||||
System.out.println(s);
|
||||
System.out.println("Removing " + s.removeItemAt(0));
|
||||
System.out.println(s);
|
||||
System.out.println("Removing " + s.removeItemAt(3));
|
||||
System.out.println(s);
|
||||
|
||||
// Comparator c = new StringComparator();
|
||||
// ComparatorLinkedList s = new ComparatorLinkedList(c);
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Betty");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Dave");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Catherine");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Thomas-1");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Sandra");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Thomas-2");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Alice-1");
|
||||
// System.out.println(s);
|
||||
// s.insertInOrder("Alice-2");
|
||||
// System.out.println(s);
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
public class TestDoubkyList {
|
||||
public static void main(String[] args) throws EmptyListException {
|
||||
DoublyList s = new DoublyList();
|
||||
System.out.println(s);
|
||||
|
||||
s.addToTail(1);
|
||||
System.out.println(s);
|
||||
|
||||
s.addToTail(2);
|
||||
System.out.println(s);
|
||||
|
||||
s.addToTail(3);
|
||||
System.out.println(s);
|
||||
|
||||
s.addToHead(0);
|
||||
|
||||
System.out.println(s.forward());
|
||||
System.out.println(s.backward());
|
||||
|
||||
while (!s.isEmpty()) {
|
||||
System.out.println("removed: " + s.removeFromHead());
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
189
_resources/it114105/itp4510/Lab03/Lab3.1/src/TestLinkedList.java
Normal file
189
_resources/it114105/itp4510/Lab03/Lab3.1/src/TestLinkedList.java
Normal file
@@ -0,0 +1,189 @@
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestLinkedList {
|
||||
|
||||
private LinkedList list;
|
||||
|
||||
@Before
|
||||
public void init(){
|
||||
list = new LinkedList();
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown(){
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToHead1(){
|
||||
list.addToHead("1");
|
||||
assertEquals(list.toString().trim(), "1");
|
||||
assertEquals(list.count, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToHead2(){
|
||||
list.addToHead("3");
|
||||
list.addToHead("2");
|
||||
list.addToHead("1");
|
||||
assertEquals(list.toString().trim(), "1 2 3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToTail1(){
|
||||
list.addToTail("1");
|
||||
list.addToTail("2");
|
||||
list.addToTail("3");
|
||||
assertEquals(list.toString().trim(), "1 2 3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToTail2(){
|
||||
list.addToTail("1");
|
||||
assertEquals(list.toString().trim(), "1");
|
||||
assertEquals(list.count, 1);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testRemoveFromTail1(){
|
||||
list.removeFromTail();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveFromTail2(){
|
||||
list.addToTail(1);
|
||||
list.removeFromTail();
|
||||
assertEquals(list.count, 0);
|
||||
assertEquals(list.toString().trim(), "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveFromTail3(){
|
||||
list.addToTail("1");
|
||||
list.addToTail("2");
|
||||
list.addToTail("3");
|
||||
list.addToTail("4");
|
||||
list.addToHead("0");
|
||||
list.removeFromTail();
|
||||
Object data = list.removeFromTail();
|
||||
assertEquals(data.toString(), "3");
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testRemoveFromHead1() {
|
||||
list.removeFromHead();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveFromHead2() {
|
||||
list.addToHead("3");
|
||||
list.addToHead("2");
|
||||
list.addToHead("1");
|
||||
list.addToHead("0");
|
||||
Object data = list.removeFromHead();
|
||||
assertEquals(data.toString(), "0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveFromHead3(){
|
||||
list.addToTail("1");
|
||||
list.addToHead("0");
|
||||
list.addToTail("2");
|
||||
list.removeFromHead();
|
||||
list.removeFromHead();
|
||||
list.removeFromHead();
|
||||
assertEquals(list.toString().trim(), "");
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testGetItemAt1(){
|
||||
list.getItemAt(-1);
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testGetItemAt2(){
|
||||
list.getItemAt(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetItemAt3(){
|
||||
list.addToTail(1);
|
||||
assertEquals(list.getItemAt(0), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetItemAt4(){
|
||||
list.addToTail(1);
|
||||
list.addToTail(2);
|
||||
list.addToTail(3);
|
||||
list.addToTail(4);
|
||||
list.removeFromTail();
|
||||
assertEquals(list.getItemAt(2), 3);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testRemoveItemAt1(){
|
||||
list.removeItemAt(-1);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testRemoveItemAt2(){
|
||||
list.removeItemAt(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveItemAt3(){
|
||||
list.addToTail(1);
|
||||
assertEquals(list.removeItemAt(0), 1);
|
||||
assertEquals(list.count, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveItemAt4(){
|
||||
list.addToTail(1);
|
||||
list.addToTail(2);
|
||||
list.addToTail(3);
|
||||
list.addToTail(4);
|
||||
assertEquals(list.removeItemAt(2), 3);
|
||||
assertEquals(list.count, 3);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testAddItemAt1(){
|
||||
System.out.println(list.count);
|
||||
list.addItemAt(1, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddItemAt2(){
|
||||
list.addItemAt(1, 0);
|
||||
assertEquals(list.count, 1);
|
||||
assertEquals(list.toString().trim(), "1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddItemAt3(){
|
||||
list.addItemAt(2, 0);
|
||||
list.addItemAt(1, 0);
|
||||
assertEquals(list.count, 2);
|
||||
assertEquals(list.toString().trim(), "1 2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddItemAt4(){
|
||||
list.addToTail(1);
|
||||
list.addItemAt(2, 1);
|
||||
list.addItemAt(3, 2);
|
||||
list.addItemAt(4, 3);
|
||||
assertEquals(list.count, 4);
|
||||
assertEquals(list.toString().trim(), "1 2 3 4");
|
||||
}
|
||||
|
||||
|
||||
}
|
19
_resources/it114105/itp4510/Lab03/Lab3.1/src/TestPerson.java
Normal file
19
_resources/it114105/itp4510/Lab03/Lab3.1/src/TestPerson.java
Normal file
@@ -0,0 +1,19 @@
|
||||
public class TestPerson {
|
||||
public static void main(String[] args) throws ItemNotFoundException, EmptyListException {
|
||||
Comparator c = new PersonComparator();
|
||||
ComparatorLinkedList s = new ComparatorLinkedList(c);
|
||||
System.out.println(s);
|
||||
s.insertInOrder(new Person("Betty", 21));
|
||||
System.out.println(s);
|
||||
s.insertInOrder(new Person("Sandra", 19));
|
||||
System.out.println(s);
|
||||
s.insertInOrder(new Person("Alice", 32));
|
||||
System.out.println(s);
|
||||
s.insertInOrder(new Person("John", 15));
|
||||
System.out.println(s);
|
||||
s.insertInOrder(new Person("Kenneth", 19));
|
||||
System.out.println(s);
|
||||
s.removeItem(new Person("unknown", 15));
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user