Packagecom.addicted2flash.util
Classpublic class Collections

This class consists exclusively of static methods that operate on or return collections.



Public Methods
 MethodDefined by
  
copy(src:IList, dest:IList):void
[static] Copies all of the elements from one list into another.
Collections
  
[static] Returns true if the two specified collections have no elements in common.
Collections
  
fill(list:IList, o:*):void
[static] Replaces all of the elements of the specified list with the specified element.
Collections
  
max(list:IList, cmp:IComparator):*
[static] Returns the maximum element of the given collection, according to the order induced by the spedified IComparator.
Collections
  
min(list:IList, cmp:IComparator):*
[static] Returns the minimum element of the given collection, according to the order induced by the spedified IComparator.
Collections
  
replaceAll(list:IList, oldVal:*, newVal:*):Boolean
[static] Replaces all occurrences of one specified value in a list with another.
Collections
  
reverse(list:IList):void
[static] Reverses the order of the elements in the specified list.
Collections
  
rotate(list:IList, distance:int):void
[static] Rotates the elements in the specified list by the specified distance.
Collections
  
shuffle(list:IList):void
[static] Randomly permutes the specified list using Math.random().
Collections
  
sort(list:IList, comp:IComparator):void
[static] Sorts a IList with a given IComparator.
Collections
Method detail
copy()method
public static function copy(src:IList, dest:IList):void

Copies all of the elements from one list into another. After the operation, the index of each copied element in the destination list will be identical to its index in the source list.

Parameters
src:IList — source list.
 
dest:IList — destination list.
disjoint()method 
public static function disjoint(c1:ICollection, c2:ICollection):Boolean

Returns true if the two specified collections have no elements in common.

Parameters
c1:ICollection — a collection
 
c2:ICollection — a collection

Returns
Boolean — true if the two specified collections have no elements in common
fill()method 
public static function fill(list:IList, o:*):void

Replaces all of the elements of the specified list with the specified element.

Parameters
list:IListIList to be filled
 
o:* — element with which to fill the specified list
max()method 
public static function max(list:IList, cmp:IComparator):*

Returns the maximum element of the given collection, according to the order induced by the spedified IComparator.

Parameters
list:IListIList
 
cmp:IComparatorIComparator

Returns
* — the maximum element of the given collection, according to the order induced by the specified IComparator
min()method 
public static function min(list:IList, cmp:IComparator):*

Returns the minimum element of the given collection, according to the order induced by the spedified IComparator.

Parameters
list:IListIList
 
cmp:IComparatorIComparator

Returns
* — the minimum element of the given collection, according to the order induced by the specified IComparator
replaceAll()method 
public static function replaceAll(list:IList, oldVal:*, newVal:*):Boolean

Replaces all occurrences of one specified value in a list with another.

Parameters
list:IListIList
 
oldVal:* — old value to be replaced
 
newVal:* — new value with which oldVal is to be replaced

Returns
Boolean — true if at least one element was replaced
reverse()method 
public static function reverse(list:IList):void

Reverses the order of the elements in the specified list.

Parameters
list:IListIList to be reversed
rotate()method 
public static function rotate(list:IList, distance:int):void

Rotates the elements in the specified list by the specified distance.

Parameters
list:IListIList
 
distance:int — distance to rotate the list. It may be zero, negative, or greater than list.size()
shuffle()method 
public static function shuffle(list:IList):void

Randomly permutes the specified list using Math.random().

Parameters
list:IListIList to be randomly shuffled
sort()method 
public static function sort(list:IList, comp:IComparator):void

Sorts a IList with a given IComparator.

Parameters
list:IListIList to be sorted
 
comp:IComparatorIComparator