| Package | org.as3collections.utils |
| Class | public class CollectionUtil |
| Inheritance | CollectionUtil Object |
ICollection interface.
CollectionUtil handles null input collections quietly in almost all methods. When not, it's documented in the method.
That is to say that a null input will not thrown an error in almost all methods.
| Method | Defined By | ||
|---|---|---|---|
CollectionUtil is a static class and shouldn't be instantiated. | CollectionUtil | ||
containsDuplication(collection:ICollection):Boolean [static] | CollectionUtil | ||
containsOnlyType(collection:ICollection, type:*, strict:Boolean = false):Boolean [static]
Returns true if the collection contains only elements of the type argument. | CollectionUtil | ||
[static]
Performs an arbitrary, specific evaluation of equality between the two arguments. | CollectionUtil | ||
[static]
Performs an arbitrary, specific evaluation of equality between this object and the other object. | CollectionUtil | ||
[static]
Returns the collection object containing only objects of the type of the type argument. | CollectionUtil | ||
[static] | CollectionUtil | ||
maxValue(collection:ICollection):Number [static]
Returns the largest number in the specified collection. | CollectionUtil | ||
maxValueIndex(collection:ICollection):int [static]
Returns the index position of the largest number in the specified collection. | CollectionUtil | ||
[static]
Removes all occurances of a the given element argument from the given collection argument. | CollectionUtil | ||
[static]
Removes duplicated objects. | CollectionUtil | ||
[static]
Shuffles the position of the elements of the given collection. | CollectionUtil | ||
[static]
Sorts the collection of String objects alphabetically. | CollectionUtil | ||
sortAlphabeticallyByObjectProperty(collection:ICollection, property:String, comparison:AlphabeticalComparison):ICollection [static]
Sorts the collection of objects alphabetically through the object's property. | CollectionUtil | ||
[static]
Sorts the collection of Number objects ascending. | CollectionUtil | ||
[static]
Sorts the collection of objects ascending through the object's property (must be a numeric value). | CollectionUtil | ||
[static]
Sorts the array of Number objects descending. | CollectionUtil | ||
[static]
Sorts the array of objects descending through the object's property (must be a numeric value). | CollectionUtil | ||
toString(collection:ICollection):String [static]
Returns the string representation of the collection argument. | CollectionUtil | ||
| CollectionUtil | () | Constructor |
public function CollectionUtil()
CollectionUtil is a static class and shouldn't be instantiated.
IllegalOperationError — CollectionUtil is a static class and shouldn't be instantiated.
|
| containsDuplication | () | method |
public static function containsDuplication(collection:ICollection):BooleanParameters
collection:ICollection |
Boolean |
| containsOnlyType | () | method |
public static function containsOnlyType(collection:ICollection, type:*, strict:Boolean = false):Boolean
Returns true if the collection contains only elements of the type argument.
This method uses org.as3utils.ArrayUtil.containsOnlyType()
Parameters
collection:ICollection — the collection to check. May be null.
| |
type:* — the type of the elements.
| |
strict:Boolean (default = false) — defines if the type of the elements should be strictly equal.
|
Boolean — true if the collection contains only elements of the type argument. If the collection is null or empty returns false.
|
| equalConsideringOrder | () | method |
public static function equalConsideringOrder(collection1:ICollection, collection2:ICollection):Boolean
Performs an arbitrary, specific evaluation of equality between the two arguments.
If one of the collections or both collections are null it will be returned false.
Two different objects are considered equal if:
This implementation takes care of the order of the elements in the collections. So, for two collections are equal the order of elements returned by the iterator object must be equal.
Parameters
collection1:ICollection — the first collection.
| |
collection2:ICollection — the second collection.
|
Boolean — true if the arbitrary evaluation considers the objects equal.
|
| equalNotConsideringOrder | () | method |
public static function equalNotConsideringOrder(collection1:ICollection, collection2:ICollection):Boolean
Performs an arbitrary, specific evaluation of equality between this object and the other object.
If one of the collections or both collections are null it will be returned false.
Two different objects are considered equal if:
This implementation does not takes care of the order of the elements in the collections.
Parameters
collection1:ICollection — the first collection.
| |
collection2:ICollection — the second collection.
|
Boolean — true if the arbitrary evaluation considers the objects equal.
|
| filterByType | () | method |
public static function filterByType(collection:ICollection, type:Class):ICollection
Returns the collection object containing only objects of the type of the type argument.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection for filtering. May be null.
| |
type:Class — the type of the objects that should remain in the collection.
|
ICollection — the collection object containing only objects of the type of the type argument.
|
| getDuplicate | () | method |
public static function getDuplicate(collection:ICollection):ICollectionParameters
collection:ICollection |
ICollection |
| maxValue | () | method |
public static function maxValue(collection:ICollection):NumberReturns the largest number in the specified collection.
Parameters
collection:ICollection — the collection object to check. May be null.
|
Number — the largest number in the collection object. If the collection argument is null or empty then the return is NaN.
|
| maxValueIndex | () | method |
public static function maxValueIndex(collection:ICollection):intReturns the index position of the largest number in the specified collection.
Parameters
collection:ICollection — the collection object to check. May be null.
|
int — the index position of the largest number in the collection object. If the collection argument is null or empty then the return is -1.
|
| removeAllOccurances | () | method |
public static function removeAllOccurances(collection:ICollection, element:*):ICollection
Removes all occurances of a the given element argument from the given collection argument.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection | |
element:* |
ICollection — |
| removeDuplicate | () | method |
public static function removeDuplicate(collection:ICollection):ICollectionRemoves duplicated objects.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to remove duplicated objects.
|
ICollection — the collection object without duplicated objects.
|
| shuffle | () | method |
public static function shuffle(collection:ICollection):ICollection
Shuffles the position of the elements of the given collection.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to shuffle. May be null.
|
ICollection — the modified collection.
|
| sortAlphabetically | () | method |
public static function sortAlphabetically(collection:ICollection, comparison:AlphabeticalComparison):ICollection
Sorts the collection of String objects alphabetically.
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortAlphabetically method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
| |
comparison:AlphabeticalComparison — indicates which type of comparison will be used.
|
ICollection — the sorted collection.
|
| sortAlphabeticallyByObjectProperty | () | method |
public static function sortAlphabeticallyByObjectProperty(collection:ICollection, property:String, comparison:AlphabeticalComparison):ICollection
Sorts the collection of objects alphabetically through the object's property.
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortAlphabeticallyByObjectProperty method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
| |
property:String — the name of the property to be recovered and compared between the objects.
| |
comparison:AlphabeticalComparison — indicates which type of comparison will be used.
|
ICollection — the sorted collection.
|
| sortAscending | () | method |
public static function sortAscending(collection:ICollection):ICollection
Sorts the collection of Number objects ascending.
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortAscending method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
|
ICollection — the sorted collection.
|
| sortAscendingByObjectProperty | () | method |
public static function sortAscendingByObjectProperty(collection:ICollection, property:String):ICollectionSorts the collection of objects ascending through the object's property (must be a numeric value).
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortAscendingByObjectProperty method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
| |
property:String — the name of the property to be recovered and compared between the objects.
|
ICollection — the sorted collection.
|
| sortDescending | () | method |
public static function sortDescending(collection:ICollection):ICollection
Sorts the array of Number objects descending.
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortDescending method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
|
ICollection — the sorted collection.
|
| sortDescendingByObjectProperty | () | method |
public static function sortDescendingByObjectProperty(collection:ICollection, property:String):ICollectionSorts the array of objects descending through the object's property (must be a numeric value).
This method uses the org.as3coreaddendum.utils.ArrayUtil.sortDescendingByObjectProperty method.
This method modifies the original collection. Be sure that it's not a ready-only collection.
Parameters
collection:ICollection — the collection to sort.
| |
property:String — the name of the property to be recovered and compared between the objects.
|
ICollection — the sorted collection.
|
| toString | () | method |
public static function toString(collection:ICollection):String
Returns the string representation of the collection argument.
Parameters
collection:ICollection — the target collection.
|
String — the string representation of the target collection.
|