java - Group ArrayList<HashMap> by a certain key -
I have a According to the key "Nude", I want to summarize the above list, how can this be done? If you want to "group" in the general sense, you do not want to use the structure, then you can use another map Using ArrayList & lt; HashMap & LT; String, string & gt; & Gt; The keys of which they stored some values associated with them.
Map = New Hashmap & lt; String, string & gt; (); Map.put (NEWTITLE, title); map.put (TITLE, description); Map.put (THUMBNAILPATH, thumbnail); Map.put (body, body); Map.put (NEWID, newId); map.put (ID, newsId); Map.put (publisher, PUBLISHERNAME); myNList.add (map);
Compare Implementation gives commands that you want, and
Collections. Sort (list, compare) use
need on the map & lt; string, list & lt; map & lt; string, string & gt; & gt; & gt; ;
Comments
Post a Comment