I have the following code:
Object[] list = {"1", "2", "3", "4", "5"};
ArrayList list1 = new ArrayList(Arrays.asList(list));
NSArray list2 = new NSArray(list);
System.out.println(list1);
System.out.println(list2);
System.out.println(list1.subList(0, 1));
System.out.println(list2.subList(0, 1));
and it produces:
[1, 2, 3, 4, 5]
("1", "2", "3", "4", "5")
[1]
("1", "2")
The sun definition of List.subList is:
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
The NSArray behaviour is "toIndex inclusive", which is wrong.
Can someone else confirm this is the case? I would otherwise just use subArrayWithRange, but the code I am working with needs to use the List collection interface.
--
Seeya...Q
Quinton Dolan - email@hidden
Gold Coast, QLD, Australia
Ph: +61 419 729 806