Package ch.ivyteam.ivy.scripting.objects
Class List<E>
- java.lang.Object
-
- ch.ivyteam.ivy.scripting.objects.NestedObject
-
- ch.ivyteam.ivy.scripting.objects.List<E>
-
- Type Parameters:
E
- The type of List-members.soap
- All Implemented Interfaces:
IIvyDataObject
,Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
public final class List<E> extends NestedObject implements List<E>
A class for typed lists. A typed List knows its member type at runtime (for use in IvyScript). For use in Java-context, the class is generic.- Since:
- March 2006
- See Also:
- Serialized Form
- API:
- This is a public API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, E element)
Inserts a new element into the list.boolean
add(E element)
Adds an element to the list.boolean
addAll(int index, Collection<? extends E> elements)
Inserts all elemnts of some collection into this list.boolean
addAll(Collection<? extends E> elements)
Adds all elements of a collection to this list.void
clear()
List<E>
clone()
Returns a shallow copy of this List.boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
static List<Object>
create()
Creates a list for arbitrary IvyObjects.static List<Object>
create(int initCap)
Creates a list for arbitrary IvyObjects.static <C> List<C>
create(Class<C> javaClass)
Creates a List with given Java-Member type.static <C> List<C>
create(Class<C> javaClass, int initCap)
Creates a List with given Java-Member type.List<E>
deepClone()
Returns a deep copy of this List.void
elementChanged(Object object)
Notifies all listeners that the given object has changed.void
elementChangedAt(int index)
Notifies all listeners that the element at given index has changed.void
ensureCapacity(int cap)
Sets the capacity of the list.E
get(int index)
(package private) int
hashCode(int level)
Computes a hashcode considering elements up to a certain nesting depth.int
indexOf(Object o)
boolean
isEmpty()
Iterator<E>
iterator()
int
lastIndexOf(Object o)
ListIterator<E>
listIterator()
ListIterator<E>
listIterator(int index)
E
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
E
set(int index, E element)
Sets the value of a list element.int
size()
List<E>
subList(int fromIndex, int toIndex)
E[]
toArray()
<T> T[]
toArray(T[] a)
void
trimToSize()
Trims the wrapped array.-
Methods inherited from class ch.ivyteam.ivy.scripting.objects.NestedObject
equals, hashCode, toString
-
-
-
-
Method Detail
-
create
public static List<Object> create()
Creates a list for arbitrary IvyObjects.- Returns:
- created list
- API:
- This public API is available in Java.
-
create
public static <C> List<C> create(Class<C> javaClass)
Creates a List with given Java-Member type.- Type Parameters:
C
-- Parameters:
javaClass
-- Returns:
- created list
- API:
- This public API is available in Java.
-
create
public static List<Object> create(int initCap)
Creates a list for arbitrary IvyObjects.- Parameters:
initCap
-- Returns:
- created list
- API:
- This public API is available in Java.
-
create
public static <C> List<C> create(Class<C> javaClass, int initCap)
Creates a List with given Java-Member type.- Type Parameters:
C
-- Parameters:
javaClass
-initCap
-- Returns:
- created list
- API:
- This public API is available in Java.
-
add
public boolean add(E element)
Adds an element to the list.- Parameters:
element
- The new element.- Returns:
- Always return true.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
add
public void add(int index, E element)
Inserts a new element into the list.- Parameters:
index
- Where to insert the new element.element
- The new Element.- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
addAll
public boolean addAll(Collection<? extends E> elements)
Adds all elements of a collection to this list.- Parameters:
elements
- A collection with new elements; may be null.- Returns:
- true if this list changed as a result of the call.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
addAll
public boolean addAll(int index, Collection<? extends E> elements)
Inserts all elemnts of some collection into this list.- Parameters:
index
- Where to insert the new elements.elements
- A collection with new elements.- Returns:
- true if this list changed as a result of the call.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
set
public E set(int index, E element)
Sets the value of a list element.- Parameters:
index
- The index of the element to set.element
- The new value.- Returns:
- The element previously at the specified position.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
elementChangedAt
public void elementChangedAt(int index)
Notifies all listeners that the element at given index has changed.- Parameters:
index
-- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
elementChanged
public void elementChanged(Object object)
Notifies all listeners that the given object has changed.- Parameters:
object
-- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
contains
public boolean contains(Object o)
- See Also:
List.contains(java.lang.Object)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
containsAll
public boolean containsAll(Collection<?> c)
- See Also:
List.containsAll(java.util.Collection)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
get
public E get(int index)
- See Also:
List.get(int)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
indexOf
public int indexOf(Object o)
- See Also:
List.indexOf(java.lang.Object)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
isEmpty
public boolean isEmpty()
- See Also:
List.isEmpty()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
iterator
public Iterator<E> iterator()
- See Also:
List.iterator()
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
lastIndexOf
public int lastIndexOf(Object o)
- See Also:
List.lastIndexOf(java.lang.Object)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
listIterator
public ListIterator<E> listIterator()
- See Also:
List.listIterator()
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
listIterator
public ListIterator<E> listIterator(int index)
- See Also:
List.listIterator(int)
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
remove
public boolean remove(Object o)
- See Also:
List.remove(java.lang.Object)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
remove
public E remove(int index)
- See Also:
List.remove(int)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
removeAll
public boolean removeAll(Collection<?> c)
- See Also:
List.removeAll(java.util.Collection)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
retainAll
public boolean retainAll(Collection<?> c)
- See Also:
List.retainAll(java.util.Collection)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
subList
public List<E> subList(int fromIndex, int toIndex)
- See Also:
List.subList(int, int)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
toArray
public E[] toArray()
- See Also:
List.toArray()
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
toArray
public <T> T[] toArray(T[] a)
- Type Parameters:
T
- The type of the argument array- Parameters:
a
-- Returns:
- array with list contents
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
clear
public void clear()
- See Also:
List.clear()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
size
public int size()
- See Also:
List.size()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
ensureCapacity
public void ensureCapacity(int cap)
Sets the capacity of the list.- Parameters:
cap
-- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
clone
public List<E> clone()
Returns a shallow copy of this List.- Specified by:
clone
in interfaceIIvyDataObject
- Overrides:
clone
in classNestedObject
- Returns:
- A clone
- See Also:
Object.clone()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
deepClone
public List<E> deepClone()
Returns a deep copy of this List.- Specified by:
deepClone
in interfaceIIvyDataObject
- Overrides:
deepClone
in classNestedObject
- Returns:
- A clone
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
hashCode
int hashCode(int level)
Computes a hashcode considering elements up to a certain nesting depth.- Parameters:
level
- The nesting depth.- Returns:
- a HashCode
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
trimToSize
public void trimToSize()
Trims the wrapped array.- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
-