View RSS Feed

My Java Tips


Rate this Entry
by , 11-03-2011 at 01:10 PM (1230 Views)
AbstractList implements Collection and List interfaces. ArrayList, Vector and AbstractSequentialList extends from AbstractList. Actually AbstractList contains implementation of List interface for random access.

If you want to create a list that should not be modified, then you should extend this class. But then you have to provide implementations for the get(int index) and size() methods.

Java Code:
public class MyList extends AbstractList {

	public Object get(int arg0) {
		return null;

	public int size() {
		return 0;
If you want a list to be modifiable, then you must additionally override set(int index, Object element) method.

Submit "AbstractList" to Facebook Submit "AbstractList" to Digg Submit "AbstractList" to Submit "AbstractList" to StumbleUpon Submit "AbstractList" to Google

Tags: None Add / Edit Tags
Java SE