java - Group ArrayList<HashMap> by a certain key -


I have a 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);

According to the key "Nude", I want to summarize the above list, how can this be done?

3) HashMap & lt; String, String & gt; & gt; Compare Implementation gives commands that you want, and Collections. Sort (list, compare) use

If you want to "group" in the general sense, you do not want to use the structure, then you can use another map Using newId as the key).

  need on the map & lt; string, list & lt; map & lt; string, string & gt; & gt; & gt; ;    

Comments

Popular posts from this blog

c# - Roxy file manager in MVC doesn't accept session path -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

java - Ajax call to jsp and jsp redirecting to further jsp -