import org.apache.commons.collections4.list.ArrayListWrapper; import org.apache.commons.collections4.list.LinkedListWrapper; public class ListExample { public static void main(String[] args) { ArrayListWrapper<String> arrayList = new ArrayListWrapper<>(); arrayList.add("A"); arrayList.add("B"); arrayList.add("C"); System.out.println("ArrayList: " + arrayList); LinkedListWrapper<String> linkedList = new LinkedListWrapper<>(); linkedList.add("A"); linkedList.add("B"); linkedList.add("C"); System.out.println("LinkedList: " + linkedList); } } import org.apache.commons.collections4.set.HashSetWrapper; import org.apache.commons.collections4.set.TreeSetWrapper; public class SetExample { public static void main(String[] args) { HashSetWrapper<String> hashSet = new HashSetWrapper<>(); hashSet.add("A"); hashSet.add("B"); hashSet.add("C"); System.out.println("HashSet: " + hashSet); TreeSetWrapper<String> treeSet = new TreeSetWrapper<>(); treeSet.add("A"); treeSet.add("B"); treeSet.add("C"); System.out.println("TreeSet: " + treeSet); } }


上一篇:
下一篇:
切换中文