Package | com.yworks.bridge.util |
Class | public class Collections |
Inheritance | Collections YObject Object |
Method | Defined By | ||
---|---|---|---|
Collections(init:Boolean = true) | Collections | ||
addAll(c:Collection, a:Vector.<Object>):Boolean [static]
Adds all the specified elements to the specified collection
| Collections | ||
binarySearch(list:List, object:Object):int [static]
Performs a binary search for the specified element in the specified sorted List. | Collections | ||
[static]
Performs a binary search for the specified element in the specified sorted List using the specified Comparator. | Collections | ||
[static]
Copies the elements from the source list to the destination list. | Collections | ||
[static]
Returns true if the collections have no elements in common
| Collections | ||
[static]
Returns a type-safe empty, immutable com.yworks.bridge.util.List. | Collections | ||
[static]
Returns a type-safe empty, immutable com.yworks.bridge.util.Map. | Collections | ||
[static]
Returns a type-safe empty, immutable com.yworks.bridge.util.Set. | Collections | ||
equals(o:Object):Boolean | YObject | ||
[static]
Fills the specified List with the specified element. | Collections | ||
frequency(c:Collection, o:Object):int [static]
Returns the number of elements in the Collection that match the Object passed. | Collections | ||
getClass():Class [override] | Collections | ||
hashCode():int | YObject | ||
[static]
Searches the list for sublist and answers the beginning index of the first occurrence. | Collections | ||
[static]
Searches the list for sublist and answers the beginning index of the last occurrence. | Collections | ||
max(collection:Collection):Object [static]
Searches the specified Collection for the maximum element. | Collections | ||
[static]
Searches the specified Collection for the maximum element using the specified Comparator. | Collections | ||
min(collection:Collection):Object [static]
Searches the specified Collection for the minimum element. | Collections | ||
[static]
Searches the specified Collection for the minimum element using the specified Comparator. | Collections | ||
[static]
Answers a List containing the specified number of the specified element. | Collections | ||
replaceAll(list:List, obj:Object, obj2:Object):Boolean [static]
Replaces all occurrences of Object obj in list with newObj. | Collections | ||
[static]
Returns the supplied List with the order of its contained elements reversed. | Collections | ||
[static]
A Comparator which reverses the natural order of the elements. | Collections | ||
[static]
Returns a Comparator that reverses the order of the Comparator passed. | Collections | ||
[static]
Rotates the elements in List list by the distance dist. | Collections | ||
[static]
Moves every element of the List to a random new position in the list. | Collections | ||
[static]
Moves every element of the List to a random new position in the list using the specified random number generator. | Collections | ||
[static]
Answers a Set containing the specified element. | Collections | ||
singletonList(object:Object):List [static]
Answers a List containing the specified element. | Collections | ||
singletonMap(key:Object, value:Object):Map [static]
Answers a Map containing the specified key and value. | Collections | ||
[static]
Sorts the specified List using the specified Comparator. | Collections | ||
[static]
Sorts the specified List in ascending order. | Collections | ||
[static]
Swaps the elements of List list at indices index1 and index2
| Collections | ||
[static]
Answers a wrapper on the specified Collection which synchronizes all access to the Collection. | Collections | ||
[static]
Answers a wrapper on the specified List which synchronizes all access to the List. | Collections | ||
[static]
Answers a wrapper on the specified Map which synchronizes all access to the Map. | Collections | ||
[static]
Answers a wrapper on the specified Set which synchronizes all access to the Set. | Collections | ||
[static]
Answers a wrapper on the specified SortedMap which synchronizes all access to the SortedMap. | Collections | ||
[static]
Answers a wrapper on the specified SortedSet which synchronizes all access to the SortedSet. | Collections | ||
[static]
Answers a wrapper on the specified Collection which throws an UnsupportedOperationException whenever an attempt is made to modify the Collection. | Collections | ||
[static]
Answers a wrapper on the specified List which throws an UnsupportedOperationException whenever an attempt is made to modify the List. | Collections | ||
[static]
Answers a wrapper on the specified Map which throws an UnsupportedOperationException whenever an attempt is made to modify the Map. | Collections | ||
[static]
Answers a wrapper on the specified Set which throws an UnsupportedOperationException whenever an attempt is made to modify the Set. | Collections | ||
[static]
Answers a wrapper on the specified SortedMap which throws an UnsupportedOperationException whenever an attempt is made to modify the SortedMap. | Collections | ||
[static]
Answers a wrapper on the specified SortedSet which throws an UnsupportedOperationException whenever an attempt is made to modify the SortedSet. | Collections |
Constant | Defined By | ||
---|---|---|---|
EMPTY_LIST : List [static]
An immutable, serializable, empty List. | Collections | ||
EMPTY_MAP : Map [static]
An immutable, serializable, empty Map. | Collections | ||
EMPTY_SET : Set [static]
An immutable, serializable, empty Set. | Collections |
Collections | () | Constructor |
public function Collections(init:Boolean = true)
init:Boolean (default = true )
|
addAll | () | method |
public static function addAll(c:Collection, a:Vector.<Object>):Boolean
Adds all the specified elements to the specified collection
Parameters
c:Collection — the collection the elements are to be inserted into
| |
a:Vector.<Object> — the elements to insert
|
Boolean — true if the collection changed during insertion
|
flash.errors:IllegalOperationError — when the method is not supported
| |
ReferenceError — when c or elements is null, or elements contains one or more null elements and c doesn't support null elements
|
binarySearch | () | method |
public static function binarySearch(list:List, object:Object):int
Performs a binary search for the specified element in the specified sorted List.
Parameters
list:List — the sorted List to search
| |
object:Object — the element to find
|
int — the non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted
|
TypeError — when an element in the List or the search element does not implement Comparable, or cannot be compared to each other
|
binarySearchWithComparator | () | method |
public static function binarySearchWithComparator(list:List, object:Object, comparator:Comparator):int
Performs a binary search for the specified element in the specified sorted List using the specified Comparator.
Parameters
list:List — the sorted List to search
| |
object:Object — the element to find
| |
comparator:Comparator — the Comparator. If the comparator is null then the search uses the objects' natural ordering.
|
int — the non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted
|
TypeError — when an element in the list and the searched element cannot be compared to each other using the Comparator
|
copy | () | method |
public static function copy(destination:List, source:List):void
Copies the elements from the source list to the destination list.
Parameters
destination:List | |
source:List |
RangeError — when the destination List is smaller than the source List
| |
flash.errors:IllegalOperationError — when replacing an element in the destination list is not supported
|
disjoint | () | method |
public static function disjoint(c1:Collection, c2:Collection):Boolean
Returns true if the collections have no elements in common
Parameters
c1:Collection — the first collection
| |
c2:Collection — the second collection
|
Boolean — true if the collections have no elements in common
|
ReferenceError — if one of the collections is null
|
emptyList | () | method |
public static function emptyList():List
Returns a type-safe empty, immutable com.yworks.bridge.util.List.
ReturnsList — An empty com.yworks.bridge.util.List.
|
See also
emptyMap | () | method |
public static function emptyMap():Map
Returns a type-safe empty, immutable com.yworks.bridge.util.Map.
ReturnsMap — An empty com.yworks.bridge.util.Map.
|
See also
emptySet | () | method |
public static function emptySet():Set
Returns a type-safe empty, immutable com.yworks.bridge.util.Set.
ReturnsSet — An empty com.yworks.bridge.util.Set.
|
See also
fill | () | method |
public static function fill(list:List, object:Object):void
Fills the specified List with the specified element.
Parameters
list:List — the List to fill
| |
object:Object — the fill element
|
flash.errors:IllegalOperationError — when replacing an element in the List is not supported
|
frequency | () | method |
public static function frequency(c:Collection, o:Object):int
Returns the number of elements in the Collection
that match the Object
passed.
If the Object
is null
, then the number of null
elements is returned.
Parameters
c:Collection — The Collection to search.
| |
o:Object — The Object to search for.
|
int — The number of matching elements.
|
ReferenceError — if the Collection parameter is null .
|
getClass | () | method |
override public function getClass():Class
ReturnsClass |
indexOfSubList | () | method |
public static function indexOfSubList(list:List, sublist:List):int
Searches the list
for sublist
and answers the beginning index of the first occurrence.
-1 is returned if the sublist
does not exist in list
.
Parameters
list:List — the List to search sublist in
| |
sublist:List — the List to search in list
|
int — the beginning index of the first occurrence of sublist in list , or -1
|
lastIndexOfSubList | () | method |
public static function lastIndexOfSubList(list:List, sublist:List):int
Searches the list
for sublist
and answers the beginning index of the last occurrence.
-1 is returned if the sublist
does not exist in list
.
Parameters
list:List — the List to search sublist in
| |
sublist:List — the List to search in list
|
int — the beginning index of the last occurrence of sublist in list , or -1
|
max | () | method |
public static function max(collection:Collection):Object
Searches the specified Collection for the maximum element.
Parameters
collection:Collection — the Collection to search
|
Object — the maximum element in the Collection
|
TypeError — when an element in the Collection does not implement Comparable or elements cannot be compared to each other
|
max2 | () | method |
public static function max2(collection:Collection, comparator:Comparator):Object
Searches the specified Collection for the maximum element using the specified Comparator.
Parameters
collection:Collection — the Collection to search
| |
comparator:Comparator — the Comparator
|
Object — the maximum element in the Collection
|
TypeError — when elements in the Collection cannot be compared to each other using the Comparator
|
min | () | method |
public static function min(collection:Collection):Object
Searches the specified Collection for the minimum element.
Parameters
collection:Collection — the Collection to search
|
Object — the minimum element in the Collection
|
TypeError — when an element in the Collection does not implement Comparable or elements cannot be compared to each other
|
min2 | () | method |
public static function min2(collection:Collection, comparator:Comparator):Object
Searches the specified Collection for the minimum element using the specified Comparator.
Parameters
collection:Collection — the Collection to search
| |
comparator:Comparator — the Comparator
|
Object — the minimum element in the Collection
|
TypeError — when elements in the Collection cannot be compared to each other using the Comparator
|
nCopies | () | method |
public static function nCopies(length:int, object:Object):List
Answers a List containing the specified number of the specified element. The list cannot be modified.
Parameters
length:int — the size of the returned List
| |
object:Object — the element
|
List — a List containing length copies of the element
|
IllegalArgumentException — when length < 0
|
replaceAll | () | method |
public static function replaceAll(list:List, obj:Object, obj2:Object):Boolean
Replaces all occurrences of Object obj
in list
with newObj
.
If the obj
is null
, then all occurrences of null
is replaced with newObj
.
Parameters
list:List — the List to modify
| |
obj:Object — the Object to find and replace occurrences of.
| |
obj2:Object — the Object to replace all occurrences of obj in list
|
Boolean — true, if at least one occurrence of obj has been found in list
|
flash.errors:IllegalOperationError — if the list does not support setting elements
|
reverse | () | method |
public static function reverse(list:List):void
Returns the supplied List
with the order of its contained elements reversed.
Parameters
list:List — the List to reverse
|
flash.errors:IllegalOperationError — when replacing an element in the List is not supported
|
reverseOrder | () | method |
public static function reverseOrder():Comparator
A Comparator which reverses the natural order of the elements.
ReturnsComparator — A Comparator instance.
|
See also
reverseOrder2 | () | method |
public static function reverseOrder2(c:Comparator):Comparator
Returns a Comparator that reverses the order of the Comparator
passed.
If the Comparator
passed is null
, then this method is equivalent to reverseOrder().
The Comparator
that's returned is java.io.Serializable if the Comparator
passed is serializable or null
.
Parameters
c:Comparator — The Comparator to reverse or null .
|
Comparator — A Comparator instance.
|
See also
rotate | () | method |
public static function rotate(lst:List, dist:int):void
Rotates the elements in List list
by the distance dist
.
E.g. for a given list with elements [1, 2, 3, 4, 5, 6, 7, 8, 9, 0], calling rotate(list, 3) or rotate(list, -7) would modify the list to look like this: [8, 9, 0, 1, 2, 3, 4, 5, 6, 7].
Parameters
lst:List | |
dist:int — It can be any integer: 0, positive, negative, larger than the list size
|
shuffle | () | method |
public static function shuffle(list:List):void
Moves every element of the List to a random new position in the list.
Parameters
list:List — the List to shuffle
|
flash.errors:IllegalOperationError — when replacing an element in the List is not supported
|
shuffle2 | () | method |
public static function shuffle2(list:List, random:Random):void
Moves every element of the List to a random new position in the list using the specified random number generator.
Parameters
list:List — the List to shuffle
| |
random:Random — the random number generator
|
flash.errors:IllegalOperationError — when replacing an element in the List is not supported
|
singleton | () | method |
public static function singleton(object:Object):Set
Answers a Set containing the specified element. The set cannot be modified.
Parameters
object:Object — the element
|
Set — a Set containing the element
|
singletonList | () | method |
public static function singletonList(object:Object):List
Answers a List containing the specified element. The list cannot be modified.
Parameters
object:Object — the element
|
List — a List containing the element
|
singletonMap | () | method |
public static function singletonMap(key:Object, value:Object):Map
Answers a Map containing the specified key and value. The map cannot be modified.
Parameters
key:Object — the key
| |
value:Object — the value
|
Map — a Map containing the key and value
|
sort | () | method |
public static function sort(list:List, comparator:Comparator):void
Sorts the specified List using the specified Comparator.
Parameters
list:List — the List to be sorted
| |
comparator:Comparator — the Comparator
|
TypeError — when elements in the List cannot be compared to each other using the Comparator
|
sort2 | () | method |
public static function sort2(list:List):void
Sorts the specified List in ascending order.
Parameters
list:List — the List to be sorted
|
TypeError — when an element in the List does not implement Comparable or elements cannot be compared to each other
|
swap | () | method |
public static function swap(list:List, index1:int, index2:int):void
Swaps the elements of List list
at indices index1
and index2
Parameters
list:List — the List to manipulate on
| |
index1:int — int position of the first element to swap with the element in index2
| |
index2:int — int position of the other element
|
RangeError — if index1 or index2 is out of range of this list
|
synchronizedCollection | () | method |
public static function synchronizedCollection(collection:Collection):Collection
Answers a wrapper on the specified Collection which synchronizes all access to the Collection.
Parameters
collection:Collection — the Collection
|
Collection — a synchronized Collection
|
synchronizedList | () | method |
public static function synchronizedList(list:List):List
Answers a wrapper on the specified List which synchronizes all access to the List.
Parameters
list:List — the List
|
List — a synchronized List
|
synchronizedMap | () | method |
public static function synchronizedMap(map:Map):Map
Answers a wrapper on the specified Map which synchronizes all access to the Map.
Parameters
map:Map — the Map
|
Map — a synchronized Map
|
synchronizedSet | () | method |
public static function synchronizedSet(_set:Set):Set
Answers a wrapper on the specified Set which synchronizes all access to the Set.
Parameters
_set:Set — the Set
|
Set — a synchronized Set
|
synchronizedSortedMap | () | method |
public static function synchronizedSortedMap(map:SortedMap):SortedMap
Answers a wrapper on the specified SortedMap which synchronizes all access to the SortedMap.
Parameters
map:SortedMap — the SortedMap
|
SortedMap — a synchronized SortedMap
|
synchronizedSortedSet | () | method |
public static function synchronizedSortedSet(_set:SortedSet):SortedSet
Answers a wrapper on the specified SortedSet which synchronizes all access to the SortedSet.
Parameters
_set:SortedSet — the SortedSet
|
SortedSet — a synchronized SortedSet
|
unmodifiableCollection | () | method |
public static function unmodifiableCollection(collection:Collection):Collection
Answers a wrapper on the specified Collection which throws an UnsupportedOperationException
whenever an attempt is made to modify the Collection.
Parameters
collection:Collection — the Collection
|
Collection — an unmodifiable Collection
|
unmodifiableList | () | method |
public static function unmodifiableList(list:List):List
Answers a wrapper on the specified List which throws an UnsupportedOperationException
whenever an attempt is made to modify the List.
Parameters
list:List — the List
|
List — an unmodifiable List
|
unmodifiableMap | () | method |
public static function unmodifiableMap(map:Map):Map
Answers a wrapper on the specified Map which throws an UnsupportedOperationException
whenever an attempt is made to modify the Map.
Parameters
map:Map — the Map
|
Map — a unmodifiable Map
|
unmodifiableSet | () | method |
public static function unmodifiableSet(_set:Set):Set
Answers a wrapper on the specified Set which throws an UnsupportedOperationException
whenever an attempt is made to modify the Set.
Parameters
_set:Set — the Set
|
Set — a unmodifiable Set
|
unmodifiableSortedMap | () | method |
public static function unmodifiableSortedMap(map:SortedMap):SortedMap
Answers a wrapper on the specified SortedMap which throws an UnsupportedOperationException
whenever an attempt is made to modify the SortedMap.
Parameters
map:SortedMap — the SortedMap
|
SortedMap — a unmodifiable SortedMap
|
unmodifiableSortedSet | () | method |
public static function unmodifiableSortedSet(_set:SortedSet):SortedSet
Answers a wrapper on the specified SortedSet which throws an UnsupportedOperationException
whenever an attempt is made to modify the SortedSet.
Parameters
_set:SortedSet — the SortedSet
|
SortedSet — a unmodifiable SortedSet
|
EMPTY_LIST | Constant |
EMPTY_MAP | Constant |
EMPTY_SET | Constant |