Results 1 to 6 of 6
Thread: what is hashmap
- 07-27-2007, 08:22 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
- 07-27-2007, 10:28 PM #2
Senior Member
- Join Date
- Jul 2007
- Posts
- 135
- Rep Power
- 0
A Map is like a dictionary in other languages. You have a key and you lookup a value using that key. Java has two kinds of Map's HashMap and TreeMap. The HashMap uses a hash of the key for lookups whereas the TreeMap uses a binary tree for storing the keys.
HashMap<String, String> myMap = new HashMap<String, String>();
myMap.put("FirstKey", "Bob");
myMap.put("SecondKey", "Sam");
System.out.println(myMap.get("FirstKey"));
This code should print out "Bob"
- 07-28-2007, 05:06 PM #3
Member
- Join Date
- Jul 2007
- Posts
- 2
- Rep Power
- 0
hash map is storing the values in the form of key,value pair.and it was not synchronized(means it can act upon many threads).intial capacity of hasmap is 16.and load factor is 0.75.
intial capacity*loadfactor=16*0.75=12
that means after storing the 12 th key vale pair hash map size is doubled.
and it allows duplicate values.
Hash map h=new Hashmap();
(123,"ajay") 1st one is key and followed by value.
- 07-28-2007, 05:15 PM #4
Member
- Join Date
- Jul 2007
- Posts
- 2
- Rep Power
- 0
hi to every body i want learn java projct architecture.wat is the architecture nad how to represent to the interviewer.plz help me...............
- 07-28-2007, 08:53 PM #5
Member
- Join Date
- Jul 2007
- Posts
- 1
- Rep Power
- 0
please notice memory orde and read orde.
i am chinese,i enlish is very bad. i am soory.
- 08-03-2007, 01:23 PM #6
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
Similar Threads
-
HashTable vs HashMap
By bugger in forum New To JavaReplies: 7Last Post: 01-06-2011, 03:15 PM -
ArrayList into hashMap
By Preethi in forum New To JavaReplies: 2Last Post: 02-11-2008, 08:13 AM -
HashMap with objects
By otoro_java in forum New To JavaReplies: 2Last Post: 01-28-2008, 03:28 PM -
HashMap visual example
By jhetfield18 in forum Advanced JavaReplies: 1Last Post: 12-12-2007, 07:45 PM -
Hashmap
By dirtycash in forum New To JavaReplies: 5Last Post: 12-03-2007, 02:58 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks