About 127,000 results
Open links in new tab
  1. How do I efficiently iterate over each entry in a Java Map?

    If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map? Will the ordering of

  2. 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 …

  3. 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.

  4. 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 …

  5. 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:

  6. 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 …

  7. 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.

  8. 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, …

  9. 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 …

  10. 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