Check if a particular key exists in LinkedHashMap - Java Collection Framework

Java examples for Collection Framework:LinkedHashMap

Description

Check if a particular key exists in LinkedHashMap

Demo Code

 
import java.util.LinkedHashMap;
 
public class Main {
 
  public static void main(String[] args) {
    LinkedHashMap lHashMap = new LinkedHashMap();
   //w  w w  .j  a v a2  s. co  m
    lHashMap.put("1","One");
    lHashMap.put("2","Two");
    lHashMap.put("3","Three");
   
    boolean blnExists = lHashMap.containsKey("3");
    System.out.println("3 exists in LinkedHashMap ? : " + blnExists);
  }
}

Result


Related Tutorials