• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

ArrayList versus HashMap

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have to create different sets of lists(arrayLists) from a ArrayList, so i am using addall, containsall like functions in my code to build new lists. But is it worth changing the base List into Hashmap, just because we can get value by Name instead of going thru loop and find the value??
If i change it to Hashmap in order to create Lists again we have to use for loops or Iterators instead of addall. Please let me know some strong points to keep the base list as ArrayList instead of changing it to hashmap..
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you familiar with LinkedHashMap? They have the same (name,value) pairs as HashMaps but with the ability to iterator over the set in the order the items were inserted like Arraylists.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedHashMap.html
[ June 05, 2006: Message edited by: Scott Selikoff ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic