entrySet(): This method is available in java.util.WeakHashMap class of Java.
Syntax:
Set<Entry<K, K>> java.util.WeakHashMap.entrySet()
This method returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.
Parameters: NA
Returns: a set view of the mappings contained in this map.
Exceptions: NA
Approach
Java
import java.util.WeakHashMap;public class WeakHashMapentrySet {public static void main(String[] args) {WeakHashMap<String, String> weakHashMap =new WeakHashMap<String, String>();weakHashMap.put("Java", "Program");weakHashMap.put("Hello", "World");System.out.println(weakHashMap.entrySet());}}
Output:
[Hello=World, Java=Program]
No comments:
Post a Comment