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

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

c++ - Redefined variable in the other module -