I am trying to store the bundle name and its latest version in the Map.
Below is my newDirs
which is an ArrayList<Map<String, String>>()
from which I am supposed to get the Bundle name and its latest version-
[{objectName=/storage/Model/Framework/1.0.0/, objectId=4fa042a5a56c861104fa05c246cf850522a2354ca223, objectType=DIRECTORY},
{objectName=/storage/Model/Framework/1.0.1/, objectId=4fa042a5a66c860d04fa056bbe1cf50522a14094ca3f, objectType=DIRECTORY}]
Now from that above List, I am supposed to extract the latest version of Framework bundle
. So in the above case, it is 1.0.1 version
and the bundle name is Framework
. So my map will store Framework
as the Key and 1.0.1
as the version of the bundle in the above case.
Below is my code-
final List<Map<String, String>> newDirs = new ArrayList<Map<String, String>>();
for(String ss : list) {
//some code here for newDirs
Map<String, String> map = storageDirectorySort(newDirs);
System.out.println(map);
}
/**
* Sort the list and then return the map as the Bundle Name and its Latest version
*
*/
private static Map<String, String> storageDirectorySort(List<Map<String, String>> newDirs) {
Map<String, String> map = new LinkedHashMap<String, String>();
// do the sorting here and always give back the latest version of the bundle and its name
return map;
}
Can anybody help me with this. I am not sure what is the best way of doing this?