CSC/ECE 517 Fall 2007/wiki1 1 aman: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:


'''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 .
'''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 .
'''Hashes in ruby'''

Revision as of 22:48, 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 .

Hashes in ruby