Check if a particular key exists in Java LinkedHashMap example : LinkedHashMap « Collections Data Structure « Java






Check if a particular key exists in Java LinkedHashMap example


import java.util.LinkedHashMap;

public class Main {
  public static void main(String[] args) {
    LinkedHashMap<String,String> lHashMap = new LinkedHashMap<String,String>();

    lHashMap.put("1", "One");
    lHashMap.put("2", "Two");
    lHashMap.put("3", "Three");

    boolean blnExists = lHashMap.containsKey("3");
    System.out.println(blnExists);
  }
}

 








Related examples in the same category

1.Check if a particular value exists in Java LinkedHashMap example
2.Get Set view of Keys from Java LinkedHashMap
3.Get Size of Java LinkedHashMap
4.Iterate through the values of Java LinkedHashMap
5.Remove all values from Java LinkedHashMap
6.Remove value from Java LinkedHashMap
7.Simple Java LinkedHashMap
8.Check if a particular element exists in Java LinkedHashSet
9.Copy all elements of Java LinkedHashSet to an Object Array
10.Implementing a Least-Recently-Used (LRU) Cache