3:10 am - Friday April 19, 2019

Java Program for LinkedHashMap by using isEmpty () method

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

import java.util.*;
import java.util.LinkedHashMap;

class LinkedHashMapempty {
public static void main(String args[]) {
// creating LinkedHashMap Object
LinkedHashMap lhm = new LinkedHashMap();
System.out.println("Initial LinkedHashMap:" + lhm.size());
lhm.put(1, "mani");
lhm.put(6, "karthi");
lhm.put(5, "Bala");
lhm.put(4, "Anand");
lhm.put(3, "candid");
// isEmpty() method is used to check that the list is empty or not
System.out.println("Empty K V:" + lhm.isEmpty());



D:\CandidJava\Util\LinkedHashMap>javac LinkedHashMapempty.java

Note: LinkedHashMapempty.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

D:\CandidJava\Util\LInkedHashMap>java LinkedHashMapempty

Initial LinkedHashMap:0

Empty K V:false


Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply