org.omnaest.utils.structure.array
Class ArrayToListAdapter<E>

java.lang.Object
  extended by org.omnaest.utils.structure.collection.CollectionAbstract<E>
      extended by org.omnaest.utils.structure.collection.list.ListAbstract<E>
          extended by org.omnaest.utils.structure.array.ArrayToListAdapter<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E>

public class ArrayToListAdapter<E>
extends ListAbstract<E>

Adapter to use an Array instance as List. Any changes to the adapter will be reflected to the Array and vice versa.

Due to the immutable length of an Array any invocations of methods which change the size will throw an UnsupportedOperationException.

Author:
Omnaest
See Also:
Array, List, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.omnaest.utils.structure.collection.list.ListAbstract
ListAbstract.ListAbstractSublist<E>
 
Field Summary
protected  E[] array
           
 
Constructor Summary
ArrayToListAdapter(E[] array)
           
 
Method Summary
 boolean add(E e)
           
 void add(int index, E element)
           
 E get(int index)
           
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 E remove(int index)
           
 E set(int index, E element)
           
 int size()
           
 
Methods inherited from class org.omnaest.utils.structure.collection.list.ListAbstract
addAll, addFirst, addLast, clear, contains, descendingIterator, element, getFirst, getLast, isValidIndex, iterator, listIterator, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, subList
 
Methods inherited from class org.omnaest.utils.structure.collection.CollectionAbstract
addAll, containsAll, equals, hashCode, isEmpty, 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, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Field Detail

array

protected final E[] array
Constructor Detail

ArrayToListAdapter

public ArrayToListAdapter(E[] array)
Parameters:
array -
See Also:
ArrayToListAdapter
Method Detail

size

public int size()

add

public boolean add(E e)

get

public E get(int index)

set

public E set(int index,
             E element)

add

public void add(int index,
                E element)

remove

public E remove(int index)

indexOf

public int indexOf(Object o)

lastIndexOf

public int lastIndexOf(Object o)


Copyright © 2013. All Rights Reserved.