HashMap Example

import java.util.*;
public class HashMapDemo1 
{
public static void main(String[] args) {
	HashMap hMap = new HashMap();
	hMap.put("1", "One");
	hMap.put("2", "Two");
	hMap.put("3", "Three");
	 boolean status = hMap.containsKey("3");
	 System.out.println(status);
	Collection c = hMap.values();
	Iterator itr = c.iterator();
	while (itr.hasNext()) {
		System.out.println(itr.next());
	}
	// remove all elements 
	hMap.clear();
}
}

Download

Collections in Java

ArrayList Example
HashMap Example
HashTable Example
Array Sort
Read Properties File
Get System Properties


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code