Results 1 to 3 of 3
- 07-19-2007, 04:57 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
- 07-20-2007, 07:23 AM #2
Member
- Join Date
- Jul 2007
- Posts
- 1
- Rep Power
- 0
Hi
Hi
actually the basic implemantion of Hash map is there is no guarantiy to the order as per the the values you put . HashMap using hashtable functionality in thats way this is using index order and another thing is if you want get values from hash table ther are two vays one thing is to get the values set from hash map using value() method it terurn Collection object than after type costing each elemetn another one is using below code
HashMap<String, Integer> hmp= new HashMap<String, Integer>();
hmp.put("1", new Integer(1));
hmp.put("5", new Integer(5));
hmp.put("3", new Integer(3));
hmp.put("4", new Integer(4));
hmp.put("2", new Integer(2));
hmp.put("6", new Integer(6));
Set st = hmp.keySet();
//SortedSet st =keySet;
Iterator it = st.iterator();
while(it.hasNext())
{
System.out.println(hmp.get(it.next()));
}
System.out.println(hmp);
- 08-01-2007, 05:56 PM #3
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
Similar Threads
-
Accessing boolean Values of another values in one class.
By a_iyer20 in forum Advanced JavaReplies: 4Last Post: 04-15-2008, 02:04 PM -
HashMap: Obtaining all values in a collision?
By markus-sukram in forum New To JavaReplies: 2Last Post: 03-29-2008, 11:25 PM -
HashMap String Return
By kizilbas1 in forum New To JavaReplies: 1Last Post: 03-10-2008, 04:34 AM -
How to make a hashmap to allow duplicate values?
By Preethi in forum New To JavaReplies: 0Last Post: 02-08-2008, 01:35 PM -
Hashmap
By dirtycash in forum New To JavaReplies: 5Last Post: 12-03-2007, 03:58 AM
Bookmarks