Map<String, String> map = ...
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey() + "/" + entry.getValue());
}
On Java 10+:
for (var entry : map.entrySet()) {
System.out.println(entry.getKey() + "/" + entry.getValue());
}
Related Contents:
- Sort a Map by values
- How to directly initialize a HashMap (in a literal way)?
- Iterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop
- How can I initialise a static Map?
- How do I convert a Map to List in Java?
- Ways to iterate over a list in Java
- Java – How to create new Entry (key, value)
- Remove elements from collection while iterating
- Best way to create an empty map in Java
- Java : Iteration through a HashMap, which is more efficient?
- Filter the elements of a map based on a subset of its keys without iterating through the entire thing
- Map.Entry: How to use it?
- Java 8 list to map with stream
- Intersection of java.util.Map
- Why doesn’t Java ship with a CopyOnWriteMap?
- Difference between
- How to convert an Array to a Set in Java
- Easiest way to convert a List to a Set in Java
- Java Class that implements Map and keeps insertion order?
- Java Ordered Map
- How can I convert JSON to a HashMap using Gson?
- Iterating through a list in reverse order in java
- Assert equals between 2 Lists in Junit
- How to remove a key from HashMap while iterating over it? [duplicate]
- Arrays.asList() vs Collections.singletonList()
- Java 8: performance of Streams vs Collections
- Why aren’t Java Collections remove methods generic? [duplicate]
- How to copy Java Collections list
- Difference between Java Enumeration and Iterator
- Android-java- How to sort a list of objects by a certain value within the object
- Java Equivalent to Python Dictionaries
- Why does Collections.sort use Mergesort but Arrays.sort does not?
- What is the fastest Java collection with the basic functionality of a Queue?
- maintaining TreeSet sort as object changes value
- What are Reified Generics? How do they solve Type Erasure problems and why can’t they be added without major changes?
- Why does exist WeakHashMap, but absent WeakSet?
- java foreach skip first iteration
- Comparing two maps
- ArrayList Vs LinkedList
- Is it possible that TreeSet equals HashSet but not HashSet equals TreeSet
- Performance of traditional for loop vs Iterator/foreach in Java
- Print array without brackets and commas
- Spring can’t autowire Map bean
- Getting object with max date property from list of objects Java 8
- stream list into a set
- How to iterate through an ArrayList of Objects of ArrayList of Objects?
- Idiomatic way to create a Stream from a Nullable object
- When to use Long vs long in java?
- difference between natural ordering and total ordering
- Map.of() vs. Collections.emptyMap()