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

cmake set_source_files_properties not working properly -

python - Writing Greek in matplotlib labels, titles -

Pygame memory leak with transform.flip -