Click here to watch in Youtube :
https://www.youtube.com/watch?v=UKG0y72TU20&list=UUhwKlOVR041tngjerWxVccw
CollectionsExample.java
Output
https://www.youtube.com/watch?v=UKG0y72TU20&list=UUhwKlOVR041tngjerWxVccw
CollectionsExample.java
import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; public class CollectionsExample { public static void main(String[] args) { /* * The empty list (immutable). */ List<?> emptyList = Collections.EMPTY_LIST; System.out.println("emptyList : " + emptyList); /* * The empty map (immutable). */ Map<?, ?> emptyMap = Collections.EMPTY_MAP; System.out.println("emptyMap : " + emptyMap); /* * The empty set (immutable). */ Set<?> emptySet = Collections.EMPTY_SET; System.out.println("emptySet : " + emptySet); } }
emptyList : [] emptyMap : {} emptySet : []
https://sites.google.com/site/javaee4321/java-collections/CollectionsDemoImmutableListSetMapField.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment