Java comprehensive list

I am looking for an open source library with a composite list implementation

List list1 = new ArrayList();
list1.add("0");
List list2 = new LinkedList();
list2.add("1");
list3.add("2");
List list3 = new CompositeList(list1,list2...)

then:

assertEquals("0",list3.get(0));
assertEquals("1",list3.get(1));
assertEquals("2",list3.get(2));

My idea is that I don't need to copy everything in the source list

A quick Google didn't find anything. I didn't see it in guava or public collections (I may have ignored it) I don't have enough time to implement it correctly now

Solution

Compositecollection starting from commons collections seems to meet your needs, even if it is not static

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>