And for me performance wise holding in which collection is better considering the speed of search, insert, delete etc..
and give reasons for why to use a particular class
Go through the classes implementing Map, but for general purpose use, try HashMap.
If you can encapsulate the value in that class too, then you can use a HashSet.
Campbell Ritchie wrote:Have a look at the documentation for the different classes which implement Map; they tell you which is faster.
Do you mean have a mapping like this?
"Campbell" ---> 3
"Ilias" ---> 3
Yes, that is supported by the Map interface.
can you give a brief code for that. and how to traverse within the map, i guess we cannot use iterator. any alternate.
We expect you to be able to create your own code to test that. Read this FAQ.
ilias basha wrote:can you give a brief code for that. and how to traverse within the map, i guess we cannot use iterator. any alternate.
Maps are not intended for traversal; the nearest you will get is this method, then use an Iterator on the resultant set.