Tuesday, 7 July 2015

Java : Collection Framework : Collections [Immutable Empty List|Map|Set]


Click here to watch in Youtube :
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);

    }
}
Output
emptyList : []
emptyMap : {}
emptySet : []

To Download CollectionsDemoImmutableListSetMapField Project Click the below link
https://sites.google.com/site/javaee4321/java-collections/CollectionsDemoImmutableListSetMapField.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge