Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: ArrayList (non-generic)

An ArrayList can be traversed using either iterators or indexes.

Tutorial Details:

java.util.ArrayList allows for expandable arrays, and is the Collections replacement for the older Vector class. An ArrayList has the following advantages over an array:

An ArrayList automatically expands as data is added.
Access to any element of an ArrayList is O(1). Insertions and deletions are O(N).
An ArrayList has methods for inserting, deleting, and searching.
An ArrayList can be traversed using either iterators or indexes.
Automatic expansion. Use ArrayList when there will be a large variation in the amount of data that you would put into an array. Arrays should be used only when there is a constant amount of data. For example, storing information about the days of the week should use an array because the number of days in a week is constant. Use an array list for your email contact list because there is no upper bound on the number of contacts.


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/collections_non_generic/20lists/20arraylist.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
ArrayList (non-generic)

View Tutorial:
ArrayList (non-generic)

Related Tutorials:

The battle of the container frameworks: which should you use? - JavaWorld - January 1999
The battle of the container frameworks: which should you use? - JavaWorld - January 1999
 
Java 2 introduces print capability to the Swing Forum - JavaWorld June 1999
Java 2 introduces print capability to the Swing Forum - JavaWorld June 1999
 
Use the JVM Profiler Interface for accurate timing - JavaWorld
Use the JVM Profiler Interface for accurate timing - JavaWorld
 
Superior app management with JMX - JavaWorld June
Integrate JMX, a reusable configuration framework, with your JSPs
 
Navigate data with the Mapper framework
Navigate data with the Mapper framework
 
Reinvented wheel
Reinvented wheel
 
Check out three collections libraries
Check out three collections libraries
 
Axis-orizing objects for SOAP
Axis-orizing objects for SOAP
 
replacing implementation inheritance by contract inheritance
replacing implementation inheritance by contract inheritance
 
Java theory and practice: Generics gotchas
Generic types, added in JDK 5.0, are a significant enhancement to type safety in the Java language. However, some aspects of generics may seem confusing, or even downright bizarre, to first-time users. In this month's Java theory and practice, Brian Goetz
 
Core Java Interview Questions!
Core Java Interview Questions! Core Java Interview Questions Question: What is transient variable? Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.