• 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

Array or ArrayList

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the main differences between an Array and an ArrayList?
Thanks
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As seen in java api [documentation] about ArrayList: "Resizable-array implementation of the List interface. Implements all optional list operations, and permits all
elements, including null. In addition to implementing the List interface, this class provides methods to
manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to
Vector, except that it is unsynchronized.)"
To find out more, go here http://java.sun.com/j2se/1.3/docs/api/ and in the left hand column select the class you want to find more about, i.e. ArrayList.
Hope this helps.
Phil
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amit and Phil -
Maybe in more human terms:
1) ArrayLists are growable
2) ArrayLists can hold heterogeneous objects (mix and match)
3) Most of the 'modern' collections have stopped imbedding synchronized methods - not having them is no biggie -
4) ArrayLists have cool built-in methods that arrays wish they had:
- isEmpty
- contains
- clear
- remove
these methods make ArrayLists a lot easier and more fun to deal with than arrays.
-Bert
p.s. Phil - given my signoff it's inevitable...
you didn't used to play in a band in the S.F. area did you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic