I'm trying to sort a map by value. The data structure is as follows:
Map<String, ArrayList<Object>>
The ArrayList
contains a set of properties for a set of objects whose name corresponds to the string key value in the map.
The idea is that I want to sort these objects by property. So, let's say that transparency was a property of these objects, and transparency is stored in ArrayList.get(3)
for all objects.
How would I be able to sort it in a way such that:
I'm able to output:
Transparency Object Name
Value Name 1
Value Name 2
Value Name 3
Value Name 4
I've tried a few different sorts, and nothing seems to be working. Any ideas?
Edit: More information.
The objects inside the arrayList are all either Double type or String type, and I am defining the comparison between the two values through their default comparison. Essentially, I've organized the data like this:
The name of the object whose properties are contained in a list is the key for the map. The value given by the key is the list of properties for that object. I want to compare property(i), where i is user input, of Object A with property(i) of Object B, and then output them using System.out.print() or printf()