net.walend.collection
Interface List

All Superinterfaces:
Collection, HasState
All Known Subinterfaces:
MutableList
All Known Implementing Classes:
AbstractArrayList, MutableArrayList

public interface List
extends Collection

An ordered Collection that gives the programmer precise control over where Objects in the list exit. The index starts at 0.

Unlike Sets, objects can appear in a list more than once.

Unlike java.util.List, this interface does not override hashcode and eqauals. Instead it provides the containsAll() and sameContentsAs() methods.

Since:
20010908
Author:
David Walend

Field Summary
static List EMPTY
           
 
Method Summary
 java.lang.Object get(int index)
          Return the object at position index.
 java.util.List getJavaList()
          Return a java.util.Collection of these Objects.
 int indexOf(java.lang.Object ob)
          Returns the index of the first occurrence of ob, or -1 if ob is not in the list.
 int indexOfSubList(List subList)
          Returns the index of the subList if this List contains the subList starting at any index, or -1.
 int lastIndexOf(java.lang.Object ob)
          Returns the index of the last occurrence of ob, or -1 if ob is not in the list.
 java.util.ListIterator listIterator()
          Returns an Iterator over this list that iterates through the list in order.
 java.util.ListIterator listIterator(int start)
          Returns an Iterator over this list that iterates through the list in order, starting with the Object at index start.
 boolean sameListAs(List list)
          Returns true if this contains the same objects in the same order as list.
 
Methods inherited from interface net.walend.collection.Collection
contains, containsAll, getIdentitor, getJavaCollection, isEmpty, iterator, sameContentsAs, size
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Field Detail

EMPTY

public static final List EMPTY
Method Detail

get

public java.lang.Object get(int index)
Return the object at position index.

Throws:
java.lang.IndexOutOfBoundsException - if the index is not in the list.

indexOf

public int indexOf(java.lang.Object ob)
Returns the index of the first occurrence of ob, or -1 if ob is not in the list.


lastIndexOf

public int lastIndexOf(java.lang.Object ob)
Returns the index of the last occurrence of ob, or -1 if ob is not in the list.


listIterator

public java.util.ListIterator listIterator()
Returns an Iterator over this list that iterates through the list in order.


listIterator

public java.util.ListIterator listIterator(int start)
Returns an Iterator over this list that iterates through the list in order, starting with the Object at index start.

Throws:
java.lang.IndexOutOfBoundsException - if the index is not in the list.

indexOfSubList

public int indexOfSubList(List subList)
Returns the index of the subList if this List contains the subList starting at any index, or -1.


sameListAs

public boolean sameListAs(List list)
Returns true if this contains the same objects in the same order as list.


getJavaList

public java.util.List getJavaList()
Return a java.util.Collection of these Objects.



Copyright (c) 2000, 2001, David Walend