I have the following code given below :
final LinkedHashMap<String, Integer> linkedHashMapCounterMap = new LinkedHashMap<>(); 
linkedHashMapCounterMap.put("abc", 2); 
linkedHashMapCounterMap.put("xyz", 5); 
final String maxColln = Collections.max(
            linkedHashMapCounterMap.entrySet(),
            (entry1, entry2) -> entry1.getValue().intValue() - 
                                entry2.getValue().intValue())
     .getKey();
After running the code, I'm getting this exception :
java.util.NoSuchElementException: null at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:721) ~[?:1.8.0_202] at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:752) ~[?:1.8.0_202] at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:750) ~[?:1.8.0_202] at java.util.Collections.max(Collections.java:708) ~[?:1.8.0_202]
 
    