CSC/ECE 517 Fall 2007/wiki1 1 aman: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
'''Map''' : A map is any object which stores associations between keys and their corresponding values, in which both keys and the values are objects. The key is unique , however the values may not necessarily be unique. | '''Map''' : A map is any object which stores associations between keys and their corresponding values, in which both keys and the values are objects. The key is unique , however the values may not necessarily be unique. | ||
'''HashMaps in java''' : | |||
'''HashMaps in java''' : In java A HashMap is implemented by implementing the Map interface. A hash table is used to store the map. Maps in general do not implement the Iterable interface. Hence iterations through a map are not possible using a for loop and also it is not possible to obtain an iterator to a map. To implement the iteration feature , a collection view of the map for example a set needs to be used . |
Revision as of 22:47, 11 September 2007
Comparison of HashMaps in Java vs hashes in Ruby
Map : A map is any object which stores associations between keys and their corresponding values, in which both keys and the values are objects. The key is unique , however the values may not necessarily be unique.
HashMaps in java : In java A HashMap is implemented by implementing the Map interface. A hash table is used to store the map. Maps in general do not implement the Iterable interface. Hence iterations through a map are not possible using a for loop and also it is not possible to obtain an iterator to a map. To implement the iteration feature , a collection view of the map for example a set needs to be used .