HTML & JS
// Java program to demonstrate working of LinkedHashMap
import java.util.*;
 
public class BasicLinkedHashMap
{
    public static void main(String a[])
    {
        HashMap<String, String> lhm =
                       new HashMap<String, String>();
        lhm.put("one", "practice.geeksforgeeks.org");
        lhm.put("two", "code.geeksforgeeks.org");
        lhm.put("four", "quiz.geeksforgeeks.org");
 
        // It prints the elements in same order as they were inserted    
        System.out.println(lhm);
 
        System.out.println("Getting value for key 'one': " + lhm.get("one"));
        System.out.println("Size of the map: " + lhm.size());
        System.out.println("Is map empty? " + lhm.isEmpty());
        System.out.println("Contains key 'two'? "+ lhm.containsKey("two"));
        System.out.println("Contains value 'practice.geeksforgeeks.org'? "
                           + lhm.containsValue("practice.geeksforgeeks.org"));
        System.out.println("delete element 'one': " + lhm.remove("one"));
        System.out.println(lhm);
    }
}

Generated URL:

Output:

{four=quiz.geeksforgeeks.org, one=practice.geeksforgeeks.org, two=code.geeksforgeeks.org}
Getting value for key 'one': practice.geeksforgeeks.org
Size of the map: 3
Is map empty? false
Contains key 'two'? true
Contains value 'practice.geeksforgeeks.org'? true
delete element 'one': practice.geeksforgeeks.org
{four=quiz.geeksforgeeks.org, two=code.geeksforgeeks.org}
Report Bug