Packagecom.yworks.bridge.util
Classpublic class ArrayList
InheritanceArrayList Inheritance AbstractList Inheritance AbstractCollection Inheritance YObject Inheritance Object
Implements List, Clonable, RandomAccess

ArrayList is an implementation of List, backed by an array. All optional operations are supported, adding, removing, and replacing. The elements can be any objects.



Public Properties
 PropertyDefined By
  empty : Boolean
[override] [read-only] Answers if this ArrayList has no elements, a size of zero.
ArrayList
  length : int
[override] [read-only] Answers the number of elements in this ArrayList.
ArrayList
 InheritedmodCountInternal : int
AbstractList
Protected Properties
 PropertyDefined By
 InheritedmodCount : int
AbstractList
Public Methods
 MethodDefined By
  
ArrayList(init:Boolean = true)
Constructs a new instance of ArrayList with capacity for ten elements.
ArrayList
  
addAll(collection:Collection):Boolean
[override] Adds the objects in the specified Collection to this ArrayList.
ArrayList
  
addAllAt(location:int, collection:Collection):Boolean
[override] Inserts the objects in the specified Collection at the specified location in this ArrayList.
ArrayList
  
addItem(object:Object):Boolean
[override] Adds the specified object at the end of this ArrayList.
ArrayList
  
addItemAt(location:int, object:Object):void
[override] Inserts the specified object into this ArrayList at the specified location.
ArrayList
  
clear():void
[override] Removes all elements from this ArrayList, leaving it empty.
ArrayList
  
clone():Object
[override] Answers a new ArrayList with the same elements, size and capacity as this ArrayList.
ArrayList
 Inherited
containsAll(collection:Collection):Boolean
Searches this Collection for all objects in the specified Collection.
AbstractCollection
  
containsItem(object:Object):Boolean
[override] Searches this ArrayList for the specified object.
ArrayList
  
ensureCapacity(minimumCapacity:int):void
Ensures that this ArrayList can hold the specified number of elements without growing.
ArrayList
 Inherited
equals(object:Object):Boolean
[override] Compares the specified object to this List and answer if they are equal.
AbstractList
  
getClass():Class
[override]
ArrayList
  
getItemAt(location:int):Object
[override] Answers the element at the specified location in this ArrayList.
ArrayList
 Inherited
hashCode():int
[override] Answers an integer hash code for the receiver.
AbstractList
  
indexOf(object:Object):int
[override] Searches this ArrayList for the specified object and returns the index of the first occurrence.
ArrayList
 Inherited
[override] Answers an Iterator on the elements of this List.
AbstractList
  
lastIndexOf(object:Object):int
[override] Searches this ArrayList for the specified object and returns the index of the last occurrence.
ArrayList
 Inherited
Answers a ListIterator on the elements of this List.
AbstractList
 Inherited
Answers a ListIterator on the elements of this List.
AbstractList
  
[static] Constructs a new instance of ArrayList with capacity for ten elements.
ArrayList
  
newArrayList2(capacity:int):ArrayList
[static] Constructs a new instance of ArrayList with the specified capacity.
ArrayList
  
[static] Constructs a new instance of ArrayList containing the elements in the specified collection.
ArrayList
 Inherited
removeAll(collection:Collection):Boolean
Removes all occurrences in this Collection of each object in the specified Collection.
AbstractCollection
  
removeItem(object:Object):Boolean
[override] Removes the first one of the specified object in this list, if present.
ArrayList
  
removeItemAt(location:int):Object
[override] Removes the object at the specified location from this ArrayList.
ArrayList
 Inherited
retainAll(collection:Collection):Boolean
Removes all objects from this Collection that are not contained in the specified Collection.
AbstractCollection
  
setItemAt(location:int, object:Object):Object
[override] Replaces the element at the specified location in this ArrayList with the specified object.
ArrayList
 Inherited
subList(start:int, end:int):List
Returns a part of consecutive elements of this list as a view.
AbstractList
  
toArray():Vector.<Object>
[override] Answers a new array containing all elements contained in this ArrayList.
ArrayList
  
toArray2(contents:Vector.<Object>):Vector.<Object>
[override] Answers an array containing all elements contained in this ArrayList.
ArrayList
 Inherited
toString():String
Answers the string representation of this Collection.
AbstractCollection
  
trimToSize():void
Sets the capacity of this ArrayList to be the same as the size.
ArrayList
Protected Methods
 MethodDefined By
  
cloneImpl(o:Object):void
[override]
ArrayList
 Inherited
AbstractCollection
 Inherited
AbstractList
  
Initializes this object.
ArrayList
  
initArrayList2(capacity:int):void
Initializes this object.
ArrayList
  
initArrayList3(collection:Collection):void
Initializes this object.
ArrayList
  
removeRange(start:int, end:int):void
[override] Removes the objects in the specified range from the start to the end, but not including the end index.
ArrayList
Property Detail
emptyproperty
empty:Boolean  [read-only] [override]

Answers if this ArrayList has no elements, a size of zero.


Implementation
    public function get empty():Boolean

See also

lengthproperty 
length:int  [read-only] [override]

Answers the number of elements in this ArrayList.


Implementation
    public function get length():int
Constructor Detail
ArrayList()Constructor
public function ArrayList(init:Boolean = true)

Constructs a new instance of ArrayList with capacity for ten elements.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
addAll()method
override public function addAll(collection:Collection):Boolean

Adds the objects in the specified Collection to this ArrayList.

Parameters

collection:Collection — the Collection of objects

Returns
Boolean — true if this ArrayList is modified, false otherwise
addAllAt()method 
override public function addAllAt(location:int, collection:Collection):Boolean

Inserts the objects in the specified Collection at the specified location in this ArrayList. The objects are added in the order they are returned from the Collection iterator.

Parameters

location:int — the index at which to insert
 
collection:Collection — the Collection of objects

Returns
Boolean — true if this ArrayList is modified, false otherwise

Throws
RangeError — when location < 0 || > size()
addItem()method 
override public function addItem(object:Object):Boolean

Adds the specified object at the end of this ArrayList.

Parameters

object:Object — the object to add

Returns
Boolean — true
addItemAt()method 
override public function addItemAt(location:int, object:Object):void

Inserts the specified object into this ArrayList at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this ArrayList, the object is added at the end.

Parameters

location:int — the index at which to insert
 
object:Object — the object to add


Throws
RangeError — when location < 0 || >= size()
clear()method 
override public function clear():void

Removes all elements from this ArrayList, leaving it empty.

See also

clone()method 
override public function clone():Object

Answers a new ArrayList with the same elements, size and capacity as this ArrayList.

Returns
Object — a shallow copy of this ArrayList

See also

cloneImpl()method 
override protected function cloneImpl(o:Object):void

Parameters

o:Object

containsItem()method 
override public function containsItem(object:Object):Boolean

Searches this ArrayList for the specified object.

Parameters

object:Object — the object to search for

Returns
Boolean — true if object is an element of this ArrayList, false otherwise
ensureCapacity()method 
public function ensureCapacity(minimumCapacity:int):void

Ensures that this ArrayList can hold the specified number of elements without growing.

Parameters

minimumCapacity:int — the minimum number of elements that this ArrayList will hold before growing

getClass()method 
override public function getClass():Class

Returns
Class
getItemAt()method 
override public function getItemAt(location:int):Object

Answers the element at the specified location in this ArrayList.

Parameters

location:int — the index of the element to return

Returns
Object — the element at the specified index

Throws
RangeError — when location < 0 || >= size()
indexOf()method 
override public function indexOf(object:Object):int

Searches this ArrayList for the specified object and returns the index of the first occurrence.

Parameters

object:Object — the object to search for

Returns
int — the index of the first occurrence of the object
initArrayList1()method 
protected final function initArrayList1():void

Initializes this object. See the documentation of the corresponding factory method newArrayList1() for details.

See also

initArrayList2()method 
protected final function initArrayList2(capacity:int):void

Initializes this object. See the documentation of the corresponding factory method newArrayList2() for details.

Parameters

capacity:int

See also

initArrayList3()method 
protected final function initArrayList3(collection:Collection):void

Initializes this object. See the documentation of the corresponding factory method newArrayList3() for details.

Parameters

collection:Collection

See also

lastIndexOf()method 
override public function lastIndexOf(object:Object):int

Searches this ArrayList for the specified object and returns the index of the last occurrence.

Parameters

object:Object — the object to search for

Returns
int — the index of the last occurrence of the object
newArrayList1()method 
public static function newArrayList1():ArrayList

Constructs a new instance of ArrayList with capacity for ten elements.

Returns
ArrayList
newArrayList2()method 
public static function newArrayList2(capacity:int):ArrayList

Constructs a new instance of ArrayList with the specified capacity.

Parameters

capacity:int — the initial capacity of this ArrayList

Returns
ArrayList
newArrayList3()method 
public static function newArrayList3(collection:Collection):ArrayList

Constructs a new instance of ArrayList containing the elements in the specified collection. The ArrayList will have an initial capacity which is 110% of the size of the collection. The order of the elements in this ArrayList is the order they are returned by the collection iterator.

Parameters

collection:Collection — the collection of elements to add

Returns
ArrayList
removeItem()method 
override public function removeItem(object:Object):Boolean

Removes the first one of the specified object in this list, if present.

Parameters

object:Object — the object to removes

Returns
Boolean — true if the list contains the object

See also

removeItemAt()method 
override public function removeItemAt(location:int):Object

Removes the object at the specified location from this ArrayList.

Parameters

location:int — the index of the object to remove

Returns
Object — the removed object

Throws
RangeError — when location < 0 || >= size()
removeRange()method 
override protected function removeRange(start:int, end:int):void

Removes the objects in the specified range from the start to the end, but not including the end index.

Parameters

start:int — the index at which to start removing
 
end:int — the index one past the end of the range to remove


Throws
RangeError — when start < 0, start > end or end > size()
setItemAt()method 
override public function setItemAt(location:int, object:Object):Object

Replaces the element at the specified location in this ArrayList with the specified object.

Parameters

location:int — the index at which to put the specified object
 
object:Object — the object to add

Returns
Object — the previous element at the index

Throws
RangeError — when location < 0 || >= size()
toArray()method 
override public function toArray():Vector.<Object>

Answers a new array containing all elements contained in this ArrayList.

Returns
Vector.<Object> — an array of the elements from this ArrayList
toArray2()method 
override public function toArray2(contents:Vector.<Object>):Vector.<Object>

Answers an array containing all elements contained in this ArrayList. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this ArrayList, the array element following the collection elements is set to null.

Parameters

contents:Vector.<Object> — the array

Returns
Vector.<Object> — an array of the elements from this ArrayList

Throws
Error — when the type of an element in this ArrayList cannot be stored in the type of the specified array
trimToSize()method 
public function trimToSize():void

Sets the capacity of this ArrayList to be the same as the size.

See also