Click here to watch in Youtube :
https://www.youtube.com/watch?v=Lfzw-EKRdLo&list=UUhwKlOVR041tngjerWxVccw
LinkedHashMapExample.java
Output
https://www.youtube.com/watch?v=Lfzw-EKRdLo&list=UUhwKlOVR041tngjerWxVccw
LinkedHashMapExample.java
import java.util.LinkedHashMap; /* * Example of isEmpty() method. */ public class LinkedHashMapExample { public static void main( String[] args ) { LinkedHashMap<Integer, String> linkedHashMap = new LinkedHashMap<Integer, String>(); System.out.println("linkedHashMap : " + linkedHashMap ); /* * Returns true if this map contains no key-value mappings. */ boolean isEmpty = linkedHashMap.isEmpty(); System.out.println("isEmpty : " + isEmpty + "\n"); linkedHashMap.put(1, "Apple"); linkedHashMap.put(3, "Cat"); linkedHashMap.put(2, "Ball"); System.out.println("linkedHashMap : " + linkedHashMap); isEmpty = linkedHashMap.isEmpty(); System.out.println("isEmpty : " + isEmpty); } }
linkedHashMap : {} isEmpty : true linkedHashMap : {1=Apple, 3=Cat, 2=Ball} isEmpty : false
https://sites.google.com/site/javaee4321/java-collections/LinkedHashMapDemoIsEmpty.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment