How to check if specific key exists in LinkedHashMap in Java

1 Answer

0 votes
package javaapplication1;

import java.util.LinkedHashMap;

public class JavaApplication1 {

    public static void main(String[] args) {

        LinkedHashMap lHashMap = new LinkedHashMap();
   
        // key value pairs
        lHashMap.put("1", "Java");
        lHashMap.put("2", "C#");
        lHashMap.put("3", "C++");
        lHashMap.put("4", "C");
        lHashMap.put("5", "PHP");

        boolean b = lHashMap.containsKey("4");
        System.out.println(b);
  }
}
  
/*
run:

true

*/

 



answered Sep 27, 2016 by avibootz

Related questions

1 answer 175 views
1 answer 227 views
1 answer 201 views
1 answer 201 views
1 answer 111 views
1 answer 258 views
2 answers 133 views
...