com.jme3.util
クラス SafeArrayList<E>

java.lang.Object
  上位を拡張 com.jme3.util.SafeArrayList<E>
すべての実装されたインタフェース:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>

public class SafeArrayList<E>
extends java.lang.Object
implements java.util.List<E>

Provides a list with similar modification semantics to java.util.concurrent's CopyOnWriteArrayList except that it is not concurrent and also provides direct access to the current array. This List allows modification of the contents while iterating as any iterators will be looking at a snapshot of the list at the time they were created. Similarly, access the raw internal array is only presenting a snap shot and so can be safely iterated while the list is changing.

All modifications, including set() operations will cause a copy of the data to be created that replaces the old version. Because this list is not designed for threading concurrency it further optimizes the "many modifications" case by buffering them as a normal ArrayList until the next time the contents are accessed.

Normal list modification performance should be equal to ArrayList in a many situations and always better than CopyOnWriteArrayList. Optimum usage is when modifications are done infrequently or in batches... as is often the case in a scene graph. Read operations perform superior to all other methods as the array can be accessed directly.

Important caveats over normal java.util.Lists:


コンストラクタの概要
SafeArrayList(java.lang.Class<E> elementType)
           
SafeArrayList(java.lang.Class<E> elementType, java.util.Collection<? extends E> c)
           
 
メソッドの概要
 boolean add(E e)
           
 void add(int index, E element)
           
 boolean addAll(java.util.Collection<? extends E> c)
           
 boolean addAll(int index, java.util.Collection<? extends E> c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 boolean equals(java.lang.Object o)
           
 E get(int index)
           
 E[] getArray()
          Returns a current snapshot of this List's backing array that is guaranteed not to change through further List manipulation.
 int hashCode()
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator<E> listIterator()
           
 java.util.ListIterator<E> listIterator(int index)
           
 E remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 E set(int index, E element)
           
 int size()
           
 java.util.List<E> subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
クラス java.lang.Object から継承されたメソッド
getClass, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

SafeArrayList

public SafeArrayList(java.lang.Class<E> elementType)

SafeArrayList

public SafeArrayList(java.lang.Class<E> elementType,
                     java.util.Collection<? extends E> c)
メソッドの詳細

getArray

public final E[] getArray()
Returns a current snapshot of this List's backing array that is guaranteed not to change through further List manipulation. Changes to this array may or may not be reflected in the list and should be avoided.


size

public final int size()
定義:
インタフェース java.util.Collection<E> 内の size
定義:
インタフェース java.util.List<E> 内の size

isEmpty

public final boolean isEmpty()
定義:
インタフェース java.util.Collection<E> 内の isEmpty
定義:
インタフェース java.util.List<E> 内の isEmpty

contains

public boolean contains(java.lang.Object o)
定義:
インタフェース java.util.Collection<E> 内の contains
定義:
インタフェース java.util.List<E> 内の contains

iterator

public java.util.Iterator<E> iterator()
定義:
インタフェース java.lang.Iterable<E> 内の iterator
定義:
インタフェース java.util.Collection<E> 内の iterator
定義:
インタフェース java.util.List<E> 内の iterator

toArray

public java.lang.Object[] toArray()
定義:
インタフェース java.util.Collection<E> 内の toArray
定義:
インタフェース java.util.List<E> 内の toArray

toArray

public <T> T[] toArray(T[] a)
定義:
インタフェース java.util.Collection<E> 内の toArray
定義:
インタフェース java.util.List<E> 内の toArray

add

public boolean add(E e)
定義:
インタフェース java.util.Collection<E> 内の add
定義:
インタフェース java.util.List<E> 内の add

remove

public boolean remove(java.lang.Object o)
定義:
インタフェース java.util.Collection<E> 内の remove
定義:
インタフェース java.util.List<E> 内の remove

containsAll

public boolean containsAll(java.util.Collection<?> c)
定義:
インタフェース java.util.Collection<E> 内の containsAll
定義:
インタフェース java.util.List<E> 内の containsAll

addAll

public boolean addAll(java.util.Collection<? extends E> c)
定義:
インタフェース java.util.Collection<E> 内の addAll
定義:
インタフェース java.util.List<E> 内の addAll

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends E> c)
定義:
インタフェース java.util.List<E> 内の addAll

removeAll

public boolean removeAll(java.util.Collection<?> c)
定義:
インタフェース java.util.Collection<E> 内の removeAll
定義:
インタフェース java.util.List<E> 内の removeAll

retainAll

public boolean retainAll(java.util.Collection<?> c)
定義:
インタフェース java.util.Collection<E> 内の retainAll
定義:
インタフェース java.util.List<E> 内の retainAll

clear

public void clear()
定義:
インタフェース java.util.Collection<E> 内の clear
定義:
インタフェース java.util.List<E> 内の clear

equals

public boolean equals(java.lang.Object o)
定義:
インタフェース java.util.Collection<E> 内の equals
定義:
インタフェース java.util.List<E> 内の equals
オーバーライド:
クラス java.lang.Object 内の equals

hashCode

public int hashCode()
定義:
インタフェース java.util.Collection<E> 内の hashCode
定義:
インタフェース java.util.List<E> 内の hashCode
オーバーライド:
クラス java.lang.Object 内の hashCode

get

public final E get(int index)
定義:
インタフェース java.util.List<E> 内の get

set

public E set(int index,
             E element)
定義:
インタフェース java.util.List<E> 内の set

add

public void add(int index,
                E element)
定義:
インタフェース java.util.List<E> 内の add

remove

public E remove(int index)
定義:
インタフェース java.util.List<E> 内の remove

indexOf

public int indexOf(java.lang.Object o)
定義:
インタフェース java.util.List<E> 内の indexOf

lastIndexOf

public int lastIndexOf(java.lang.Object o)
定義:
インタフェース java.util.List<E> 内の lastIndexOf

listIterator

public java.util.ListIterator<E> listIterator()
定義:
インタフェース java.util.List<E> 内の listIterator

listIterator

public java.util.ListIterator<E> listIterator(int index)
定義:
インタフェース java.util.List<E> 内の listIterator

subList

public java.util.List<E> subList(int fromIndex,
                                 int toIndex)
定義:
インタフェース java.util.List<E> 内の subList