LuanTable has these constructors:
public LuanTable(List<Object> list) {
this.list = list;
}
public LuanTable(Map<Object,Object> map) {
this.map = map;
}
public LuanTable(Set<Object> set) {
map = new HashMap<Object,Object>();
for( Object obj : set ) {
map.put(obj,Boolean.TRUE);
}
}
Note that in the first 2, the object passed is used directly in the LuanTable which means that modifications to the collection will be available to the caller. The last constructor is a convenience and I am not sure if it really should be there. Your example could be done:
List<Node> list = ...
return new LuanTable(new ArrayList<Object>(list));
This makes it clear that the list will not be changed by LuanTable.