About 115,000 results
Open links in new tab
  1. java - Iterate through a HashMap - Stack Overflow

    Jul 1, 2009 · Extracted from the reference How to Iterate Over a Map in Java: There are several ways of iterating over a Map in Java. Let's go over the most common methods and review their advantages …

  2. java - iterating over and removing from a map - Stack Overflow

    Dec 11, 2009 · For the record, this also works for the map values: Iterator it = map.values().iterator(), then it.remove() will remove it entry.

  3. What is the easiest way to iterate over all the key/value pairs of a ...

    Feb 25, 2009 · What is the easiest way to iterate over all the key/value pairs of a java.util.Map in Java 5 and higher? Asked 16 years, 9 months ago Modified 1 year, 6 months ago Viewed 35k times

  4. loops - How to iterate through a Map in java? - Stack Overflow

    2 With Java 8, I would suggest you to use Stream API. It will allow you to iterate through the Map in a much more convenient approach:

  5. java - How to for each the hashmap? - Stack Overflow

    Lambda Expression Java 8 In Java 1.8 (Java 8) this has become lot easier by using forEach method from Aggregate operations (Stream operations) that looks similar to iterators from Iterable Interface. …

  6. Java - Iterating over a Map which contains a List

    Apr 9, 2012 · I have a Map which contains a String as it's Key, and a List of Strings as it's Value. I need to iterate over all vlaues contained within each List within the Map.

  7. Java 8 streams: iterate over Map of Lists - Stack Overflow

    Dec 13, 2014 · Essentially, you stream over each entry set and collect it into a new map. To compute the value in the new map, you stream over the List<MyOjbect> from the old map, sort, and apply a …

  8. How to iterate hashmap in reverse order in Java - Stack Overflow

    You can't iterate over a HashMap in reverse because of this: This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time. …

  9. How to replace HashMap Values while iterating over them in Java

    Jun 12, 2012 · How to replace HashMap Values while iterating over them in Java Asked 13 years, 6 months ago Modified 2 years, 7 months ago Viewed 110k times

  10. Java HashMap: How to get a key and value by index?

    52 You can iterate over keys by calling map.keySet(), or iterate over the entries by calling map.entrySet(). Iterating over entries will probably be faster.