by renwick · 13y ago · 0 comments
??
val list3 = list1 ::: list 2 // returns a new list of 6 elements
final list3 = new ArrayList(list1).addAll(list2);
list3.drop(2) //return a new list without first 2 elements
new ArrayList(list3.subList(2));
list3.filter(s => s > 4) //return a list with elements 5 and 6
new ArrayList(list3.subList(4));
Also the Java versions use standard convenience methods which seems preferable to language features since anyone can re-implement them, or add new ones. Plus the copy-on-mutate behaviour is optional.
No comments yet.