• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Differences

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between ArrayList and LinkedList?
What is the difference between Hashtable and Hashmap?
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I am not sure about LinkedList, but i think that difference to ArrayList, is that it makes possible to iterate to both directorion.

Hashtable is internally synchronized. HashMap is not.

Artsi
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An ArrayList is the successor to the Vector (both are, in effect, resizeable arrays).

A linked-list is something different.
Read the JavaDocs for a description.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedList.html
Better yet, get a book or tutorial on data structures. This one is common to most languages.

The HashMap is the successor to HashTable.

All of the Collections are contained in the java.util package:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/package-frame.html

The second volume of "Core Java" devotes a whole chapter to them.
 
Shiva Priya
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!!
Thanks for the reply.Well I guess I was not very precise in my question.I want the difference between a single linked list and a ArrayList.I think only a double linked list can be travelled bidirectionally not a single linked list.So I am still not sure about the difference.
One more difference between hashtable and hashmap is that Hashmap accepts null values but Hashtable doesn't.I am not sure whether this null values refers to the key or to the value.
Please reply in this context.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..,

Linkedlist does'nt have any size..i mean, it is dynamic in size...!
Where as ArrayList is not. It do have a size..,if it comes out of its
initial size..it will increase it by half it's current size..and it will
maintain the objects in array..but linkedlist is not like that. It
dynamically adds the objects to the end. And ArrayList is prefarable
when size of the list is known or growth rate of the list known...
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can never keep this in my head, so I made a Collections Crib Sheet. It says ArrayList is faster for append and get by index. LinkedList is faster for insert and delete. I'm pretty sure I got those words from a Sun newsletter.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic