}
}
}
2.2 JavaMain.java
package com.yds.list;
public class JavaMain {
public static void main(String[] args) {
// TODO Auto-generated method stub
SequenceList《String》 list = new SequenceList《String》();
System.out.println(“isEmpty:”+list.isEmpty());
String La[] = {
“3”
};
for (int i = 0; i 《 La.length; i++) {
list.add(La[i]);
}
System.out.println(“isEmpty:”+list.isEmpty());
for (int i = 0; i 《 La.length; i++) {
System.out.println(list.get(i));
}
System.out.println(“length:”+list.length());
System.out.println(“priorElem:”+list.priorElem(1));
list.insert(“7”, 0);
System.out.println(“--------------------”);
for (int i = 0; i 《 list.length(); i++) {
System.out.println(list.get(i));
}
System.out.println(“length:”+list.length());
System.out.println(“--------------------”);
System.out.println(“priorElem:”+list.priorElem(1));
System.out.println(“nextElem:”+list.nextElem(0));
System.out.println(“--------------------”);
list.delete(1);
for (int i = 0; i 《 list.length(); i++) {
System.out.println(list.get(i));
}
list.clear();
System.out.println(“isEmpty:”+list.isEmpty());
System.out.println(“----------SequenceList(T element)----------”);
SequenceList《String》 list1 = new SequenceList《String》(“5”);
for (int i = 0; i 《 La.length; i++) {
list1.add(La[i]);
}
for (int i = 0; i 《 list1.length(); i++) {
System.out.println(list1.get(i));