magi.toolkit.util
Interface IList

All Known Implementing Classes:
MagiList

public interface IList

An immutable list interface, to allow safe distribution of this Collection. Users of the immutable list cannot make changes to the elements of the list.

Author:
Paul Atkinson, Magi Systems Pty Ltd.
See Also:
MagiList

Method Summary
 boolean contains(java.lang.Object o)
          Returns true if this list contains the specified element.
 boolean containsAll(java.util.Collection c)
          Returns true if this list contains all of the elements of the specified collection.
 boolean equals(java.lang.Object o)
          Compares the specified object with this list for equality.
 java.lang.Object get(int index)
          Returns the element at the specified position in this list.
 int hashCode()
          Returns the hash code value for this list.
 int indexOf(java.lang.Object o)
          Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
 boolean isEmpty()
          Returns true if this list contains no elements.
 java.util.Iterator iterator()
          Returns an iterator over the elements in this list in proper sequence.
 int lastIndexOf(java.lang.Object o)
          Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
 java.util.ListIterator listIterator()
          Returns a list iterator of the elements in this list (in proper sequence).
 java.util.ListIterator listIterator(int index)
          Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
 int size()
          Returns the number of elements in this list.
 java.util.List subList(int fromIndex, int toIndex)
          Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
 java.lang.Object[] toArray()
          Returns an array containing all of the elements in this list in proper sequence.
 java.lang.Object[] toArray(java.lang.Object[] arr)
          Returns an array containing all of the elements in this list in proper sequence, the runtime type of the returned array is that of the specified array.
 

Method Detail

contains

public boolean contains(java.lang.Object o)
Returns true if this list contains the specified element.

Parameters:
o - Object to check if it exists in this List.
Returns:
true if it exists, and false if not.
See Also:
List.contains(Object)

containsAll

public boolean containsAll(java.util.Collection c)
Returns true if this list contains all of the elements of the specified collection.

Parameters:
c - the Collection to check if all elements exist.
Returns:
true if all Collection elements exist in this List.
See Also:
List.containsAll(Collection)

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this list for equality.

Overrides:
equals in class java.lang.Object
Parameters:
o - Object to check for equality.
Returns:
true if the Object matches this List.
See Also:
List.equals(Object)

get

public java.lang.Object get(int index)
Returns the element at the specified position in this list.

Parameters:
index - the index of Object to return.
Returns:
the Object at that position.
See Also:
List.get(int)

hashCode

public int hashCode()
Returns the hash code value for this list.

Overrides:
hashCode in class java.lang.Object
Returns:
the int hash code.
See Also:
List.hashCode()

indexOf

public int indexOf(java.lang.Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

Parameters:
o - the Object to check index of.
Returns:
the int index of this Object.
See Also:
List.indexOf(Object)

isEmpty

public boolean isEmpty()
Returns true if this list contains no elements.

Returns:
true if the List is empty.
See Also:
List.isEmpty()

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in this list in proper sequence.

Returns:
an Iterator object.
See Also:
List.iterator()

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.

Parameters:
o - the Object to check the last index of.
Returns:
the last index of this Object.
See Also:
List.lastIndexOf(Object)

listIterator

public java.util.ListIterator listIterator()
Returns a list iterator of the elements in this list (in proper sequence).

Returns:
a ListIterator object.
See Also:
List.listIterator()

listIterator

public java.util.ListIterator listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.

Parameters:
index - the index of where to start the list iterator.
Returns:
a ListIterator object.
See Also:
List.listIterator(int)

size

public int size()
Returns the number of elements in this list.

Returns:
the int size of this List.
See Also:
List.size()

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

Parameters:
fromIndex - build the sub-list from this index.
toIndex - build the sub-list to this index.
Returns:
a sub-list of objects from the main list.
See Also:
List.subList(int,int)

toArray

public java.lang.Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence.

Returns:
an array of Objects.
See Also:
List.toArray()

toArray

public java.lang.Object[] toArray(java.lang.Object[] arr)
Returns an array containing all of the elements in this list in proper sequence, the runtime type of the returned array is that of the specified array.

Parameters:
arr - array type to return.
Returns:
an array of Objects of the same type as arr.
See Also:
List.toArray(Object[])