Tuesday, 27 January 2015

Java : Collection Framework : LinkedHashMap (Clear)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=C84YC_dlmXg&list=UUhwKlOVR041tngjerWxVccw

LinkedHashMapExample.java
import java.util.LinkedHashMap;

/*
 * Example of clear() method.
 */
public class LinkedHashMapExample
{
    public static void main( String[] args )
    {

        LinkedHashMap<Integer, String> linkedHashMap = new LinkedHashMap<Integer, String>();

        linkedHashMap.put(1, "Apple");
        linkedHashMap.put(3, "Cat");
        linkedHashMap.put(2, "Ball");

        System.out.println("linkedHashMap : " + linkedHashMap + "\n");

        /*
         * Removes all of the mappings from this map. The map will be empty
         * after this call returns.
         */
        linkedHashMap.clear();

        System.out.println("linkedHashMap : " + linkedHashMap + "\n");

    }
}
Output
linkedHashMap : {1=Apple, 3=Cat, 2=Ball}

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

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • No comments:

    Post a Comment