L
learningjava
I have a LinkedList consisting of two items.
Each item is an array or two elements and the linkes list looks like this:
LinkedList nums = new LinkedList();
int[] numset = new int[2] ;
numset[0] = 1;
numset[1] = 2;
nums.add(numset);
.....
.....
.....
I want to be able to sort the linked list by the second integer of each element.
Can I use Collections.sort(...) to achieve this?
How?
Thanks,
gklinux
Each item is an array or two elements and the linkes list looks like this:
LinkedList nums = new LinkedList();
int[] numset = new int[2] ;
numset[0] = 1;
numset[1] = 2;
nums.add(numset);
.....
.....
.....
I want to be able to sort the linked list by the second integer of each element.
Can I use Collections.sort(...) to achieve this?
How?
Thanks,
gklinux