Packageorg.as3collections.lists
Classpublic class ReadOnlyArrayList
InheritanceReadOnlyArrayList Inheritance AbstractList Inheritance AbstractArrayCollection Inheritance Object

A list that does not allow modifications. It receives all the elements by its constructor and can no longer be changed. All methods that change this list will throw an org.as3coreaddendum.errors.UnsupportedOperationError.

View the examples



Public Properties
 PropertyDefined By
 InheritedallEquatable : Boolean
[read-only] Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable.
AbstractArrayCollection
 InheritedmodCount : int
[read-only] The number of times this list has been structurally modified.
AbstractList
Public Methods
 MethodDefined By
  
ReadOnlyArrayList(source:Array)
Constructor, creates a new ReadOnlyArrayList object.
ReadOnlyArrayList
  
add(element:*):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
addAll(collection:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
addAllAt(index:int, collection:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
addAt(index:int, element:*):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
clear():void
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
clone():*
[override] Creates and return a new ReadOnlyArrayList object containing all elements in this list (in the same order).
ReadOnlyArrayList
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified object.
AbstractArrayCollection
 Inherited
containsAll(collection:ICollection):Boolean
Returns true if this collection contains all of the elements in the specified collection.
AbstractArrayCollection
 Inherited
equals(other:*):Boolean
[override] This method uses CollectionUtil.equalConsideringOrder method to perform equality, sending this list and other argument.
AbstractList
 Inherited
getAt(index:int):*
Returns the element at the specified position in this list.
AbstractList
 Inherited
indexOf(element:*, fromIndex:int = 0):int
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
AbstractList
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
AbstractArrayCollection
  
[override] Returns an iterator over a set of elements.
ReadOnlyArrayList
 Inherited
lastIndexOf(element:*, fromIndex:int = 0x7fffffff):int
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
AbstractList
  
[override] Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
ReadOnlyArrayList
  
remove(o:*):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
removeAll(collection:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
removeAt(index:int):*
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
removeRange(fromIndex:int, toIndex:int):ICollection
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
retainAll(collection:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
reverse():void
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
  
setAt(index:int, element:*):*
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyArrayList
 Inherited
size():int
Returns the number of elements in this collection.
AbstractArrayCollection
  
subList(fromIndex:int, toIndex:int):IList
[override] Returns a new ReadOnlyArrayList that is a view of the portion of this ReadOnlyArrayList between the specified fromIndex, inclusive, and toIndex, exclusive.
ReadOnlyArrayList
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
AbstractArrayCollection
 Inherited
toString():String
Returns the string representation of this instance.
AbstractArrayCollection
Constructor Detail
ReadOnlyArrayList()Constructor
public function ReadOnlyArrayList(source:Array)

Constructor, creates a new ReadOnlyArrayList object.

Parameters
source:Array — an array to fill the list.

Throws
ArgumentError — if the source argument is null.
Method Detail
add()method
override public function add(element:*):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

element:*

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
addAll()method 
override public function addAll(collection:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

collection:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
addAllAt()method 
override public function addAllAt(index:int, collection:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

index:int
 
collection:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
addAt()method 
override public function addAt(index:int, element:*):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

index:int
 
element:*

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
clear()method 
override public function clear():void

This implementation always throws an UnsupportedOperationError.


Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
clone()method 
override public function clone():*

Creates and return a new ReadOnlyArrayList object containing all elements in this list (in the same order).

Returns
* — a new ReadOnlyArrayList object containing all elements in this list (in the same order).
iterator()method 
override public function iterator():IIterator

Returns an iterator over a set of elements.

This implementation returns a ReadOnlyArrayIterator object.

Returns
IIterator — an iterator over a set of elements.

See also

listIterator()method 
override public function listIterator(index:int = 0):IListIterator

Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. The specified index indicates the first element that would be returned by an initial call to next. An initial call to previous would return the element with the specified index minus one.

This implementation returns a ReadOnlyListIterator object.

Parameters

index:int (default = 0) — index of first element to be returned from the list iterator (by a call to the next method)

Returns
IListIterator — a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.

See also

remove()method 
override public function remove(o:*):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

o:*

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
removeAll()method 
override public function removeAll(collection:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

collection:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
removeAt()method 
override public function removeAt(index:int):*

This implementation always throws an UnsupportedOperationError.

Parameters

index:int

Returns
*

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
removeRange()method 
override public function removeRange(fromIndex:int, toIndex:int):ICollection

This implementation always throws an UnsupportedOperationError.

Parameters

fromIndex:int
 
toIndex:int

Returns
ICollection

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
retainAll()method 
override public function retainAll(collection:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

collection:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
reverse()method 
override public function reverse():void

This implementation always throws an UnsupportedOperationError.


Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
setAt()method 
override public function setAt(index:int, element:*):*

This implementation always throws an UnsupportedOperationError.

Parameters

index:int
 
element:*

Returns
*

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyArrayList is a read-only list and doesn't allow modifications.
subList()method 
override public function subList(fromIndex:int, toIndex:int):IList

Returns a new ReadOnlyArrayList that is a view of the portion of this ReadOnlyArrayList between the specified fromIndex, inclusive, and toIndex, exclusive.

Parameters

fromIndex:int — the index to start retrieving elements (inclusive).
 
toIndex:int — the index to stop retrieving elements (exclusive).

Returns
IList — a new ReadOnlyArrayList that is a view of the specified range within this list.

Throws
IndexOutOfBoundsError — if fromIndex or toIndex is out of range (index < 0 || index > size()).
Examples
     import org.as3collections.IList;
     import org.as3collections.lists.ArrayList;
     import org.as3collections.lists.ReadOnlyArrayList;
     
     var list1:IList = new ArrayList([3, 5, 1, 7]);
     
     list1                       // [3,5,1,7]
     
     var list2:IList = new ReadOnlyArrayList(list1.toArray());
     
     list2                       // [3,5,1,7]
     
     list2.add(1)                // UnsupportedOperationError: ReadOnlyArrayList is a read-only list and doesn't allow modifications.
     list2.remove(1)             // UnsupportedOperationError: ReadOnlyArrayList is a read-only list and doesn't allow modifications.
     
     var list3:IList = list2.clone();
     
     list3                       // [3,5,1,7]
     
     list3.contains(2)           // false
     list3.contains(5)           // true
     list3.indexOf(5)            // 1
     list3.containsAll(list1)    // true
     list3.equals(list1)         // false
     list3.getAt(2)              // 1
     list3.subList(1, 3)         // [5,1]
     
     list3.addAll(list2)         // UnsupportedOperationError: ReadOnlyArrayList is a read-only list and doesn't allow modifications.
     list3.removeRange(1, 3)     // UnsupportedOperationError: ReadOnlyArrayList is a read-only list and doesn't allow modifications.
     
     var it:IIterator = list3.iterator();
     
     while (it.hasNext())
     {
         it.next()
     
         it.remove()             // UnsupportedOperationError: ReadOnlyArrayIterator is a read-only iterator and doesn't allow modifications in the collection.
     }
     
     var it2:IListIterator = list3.listIterator();
     
     while (it2.hasNext())
     {
         it2.next()
     
         it.add(1)               // UnsupportedOperationError: ReadOnlyListIterator is a read-only iterator and doesn't allow modifications in the list.
     }