org.fest.assertions.util
Class ArrayWrapperList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<Object>
          extended by org.fest.assertions.util.ArrayWrapperList
All Implemented Interfaces:
Iterable<Object>, Collection<Object>, List<Object>

public class ArrayWrapperList
extends AbstractList<Object>

An list-like wrapper for arrays. This class does not provide type-safety in order to handle both arrays of objects and arrays of primitives.

Author:
Alex Ruiz, Yvonne Wang

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Method Summary
 Object get(int index)
          
 Class<?> getComponentType()
          Returns the component type of the wrapped array.
 int size()
          
static ArrayWrapperList wrap(Object array)
          Wraps a given array with a ArrayWrapperList
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, 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, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Method Detail

wrap

public static ArrayWrapperList wrap(Object array)
Wraps a given array with a ArrayWrapperList

Parameters:
array - the array to wrap.
Returns:
the wrapped array or null if the given array was already null.
Throws:
IllegalArgumentException - if the array is not an array.

get

public Object get(int index)

Specified by:
get in interface List<Object>
Specified by:
get in class AbstractList<Object>

size

public int size()

Specified by:
size in interface Collection<Object>
Specified by:
size in interface List<Object>
Specified by:
size in class AbstractCollection<Object>

getComponentType

public Class<?> getComponentType()
Returns the component type of the wrapped array.

Returns:
the component type of the wrapped array.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.