org.geotools.resources
Class UnmodifiableArrayList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byorg.geotools.resources.UnmodifiableArrayList
All Implemented Interfaces:
java.util.Collection, java.util.List, java.io.Serializable

public class UnmodifiableArrayList
extends java.util.AbstractList
implements java.io.Serializable

An unmodifiable view of an array. Invoking

new UnmodifiableArrayList(array);
is equivalent to
Collections.unmodifiableList(Arrays.asList(array)));
But this class provides a very slight performance improvement since it uses one less level of indirection.

Since:
2.1
Version:
$Id: UnmodifiableArrayList.java 17890 2006-02-06 08:46:14Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UnmodifiableArrayList(java.lang.Object[] array)
          Create a new instance of an array list.
 
Method Summary
 boolean contains(java.lang.Object object)
          Returns if this collection contains the specified element.
 java.lang.Object get(int index)
          Returns the element at the specified index.
 int indexOf(java.lang.Object object)
          Returns the index in this list of the first occurence of the specified element, or -1 if the list does not contain this element.
 int lastIndexOf(java.lang.Object object)
          Returns the index in this list of the last occurence of the specified element, or -1 if the list does not contain this element.
 int size()
          Returns the list size.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

UnmodifiableArrayList

public UnmodifiableArrayList(java.lang.Object[] array)
Create a new instance of an array list. The array given in argument is not cloned.

Method Detail

size

public int size()
Returns the list size.

Specified by:
size in interface java.util.List

get

public java.lang.Object get(int index)
Returns the element at the specified index.

Specified by:
get in interface java.util.List

indexOf

public int indexOf(java.lang.Object object)
Returns the index in this list of the first occurence of the specified element, or -1 if the list does not contain this element. This method is overriden only for performance reason (the default implementation would work as well).

Specified by:
indexOf in interface java.util.List

lastIndexOf

public int lastIndexOf(java.lang.Object object)
Returns the index in this list of the last occurence of the specified element, or -1 if the list does not contain this element. This method is overriden only for performance reason (the default implementation would work as well).

Specified by:
lastIndexOf in interface java.util.List

contains

public boolean contains(java.lang.Object object)
Returns if this collection contains the specified element. This method is overriden only for performance reason (the default implementation would work as well).

Specified by:
contains in interface java.util.List


Copyright © GeoTools. All Rights Reserved.