I’m reading access logs files and grouping by IP and storing it in a map. At the end I get each IP as the key and the values are the date and urls. I’m storing the values as a list.
HashMap<String,List<String>> map = new HashMap<String,List<String>>();
The result:
IP: 46.33.8.38 ==> [[16/Jul/2011:12:25:23, /TestWebPages/index.html], [16/Jul/2011:12:25:46, /TestWebPages/MScAIS-SEWN-Search-Optimisation.html], [16/Jul/2011:12:25:46, /TestWebPages/valid-rss-rogers.png]] …
Now I would like to further group the content of the map depending on the day and time. But I don’t know how can I access the list of each key in the map and process it!
So I would like to have those webpages accessed on the same day associated with IP address in a new map.
To iterate over a map, use code like this: