A
Andoni
Hi,
I want a way of sorting a list in Java but I don't want to re-invent the
wheel as there are two sorting mechanisms in Java already.
I am using Java 1.4.1.
I have Hashtable which contains textual labels as keys and ArrayLists as
values.
I have to convert this into a LinkedHashMap which contains the same textual
labels as keys but is ordered by the size of the ArrayLists (more than one
of which may be the same), and now no longer contains the ArrayList but
rather contains the count of their values and the addition of their values
as a comma separated string!
Input:
"exe", [3, 6, 9]
"doc", [4, 2, 4]
"xls", [1, 9]
"txt", [2, 2, 3, 2]
Output:
"txt","4,9"
"exe", "3,18"
"doc", "3,10"
"xls","2,10"
Do I have to write a bubble sort myself or can I leverage something's that's
already there?
Thanks in advance,
Andoni
I want a way of sorting a list in Java but I don't want to re-invent the
wheel as there are two sorting mechanisms in Java already.
I am using Java 1.4.1.
I have Hashtable which contains textual labels as keys and ArrayLists as
values.
I have to convert this into a LinkedHashMap which contains the same textual
labels as keys but is ordered by the size of the ArrayLists (more than one
of which may be the same), and now no longer contains the ArrayList but
rather contains the count of their values and the addition of their values
as a comma separated string!
Input:
"exe", [3, 6, 9]
"doc", [4, 2, 4]
"xls", [1, 9]
"txt", [2, 2, 3, 2]
Output:
"txt","4,9"
"exe", "3,18"
"doc", "3,10"
"xls","2,10"
Do I have to write a bubble sort myself or can I leverage something's that's
already there?
Thanks in advance,
Andoni