| Package | org.as3collections.lists |
| Class | public class UniqueSortedList |
| Inheritance | UniqueSortedList UniqueList UniqueCollection Object |
| Implements | ISortedList |
UniqueSortedList works as a wrapper for a ISortedList object.
It does not allow duplicated elements in the collection.
It stores the wrapList constructor's argument in the wrappedList variable.
So every method call to this class is forwarded to the wrappedList object.
The methods that need to be checked for duplication are previously validated before forward the call.
No error is thrown by the validation of duplication.
The calls that are forwarded to the wrappedList returns the return of the wrappedList call.
You can also create unique and typed sorted lists. See below the link "ListUtil.getUniqueTypedSortedList()".
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | allEquatable : Boolean [read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable. | UniqueCollection | |
| comparator : IComparator
Defines the wrappedList comparator object to be used automatically to sort. | UniqueSortedList | ||
![]() | modCount : int [read-only]
Returns the return of the call wrappedList.modCount. | UniqueList | |
| options : uint
Defines the wrappedList options to be used automatically to sort. | UniqueSortedList | ||
| Method | Defined By | ||
|---|---|---|---|
UniqueSortedList(wrapList:ISortedList)
Constructor, creates a new TypedList object. | UniqueSortedList | ||
![]() | add(element:*):Boolean
If wrappedCollection.contains(element) returns true, then this method returns false. | UniqueCollection | |
![]() | addAll(collection:ICollection):Boolean
If the specified collection is empty returns false. | UniqueCollection | |
![]() | addAllAt(index:int, collection:ICollection):Boolean
If the specified collection is empty returns false. | UniqueList | |
![]() | addAt(index:int, element:*):Boolean
If wrappedList.contains(element) returns true then returns false. | UniqueList | |
![]() | clear():void
Forwards the call to wrappedCollection.clear. | UniqueCollection | |
clone():* [override]
Creates and return a new UniqueSortedList object with the clone of the wrappedMap object. | UniqueSortedList | ||
![]() | contains(o:*):Boolean
Forwards the call to wrappedCollection.contains. | UniqueCollection | |
![]() | containsAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.containsAll. | UniqueCollection | |
equals(other:*):Boolean [override]
Performs an arbitrary, specific evaluation of equality between this object and the other object. | UniqueSortedList | ||
![]() | getAt(index:int):*
Forwards the call to wrappedList.getAt. | UniqueList | |
![]() | indexOf(element:*, fromIndex:int = 0):int
Forwards the call to wrappedList.indexOf. | UniqueList | |
![]() | isEmpty():Boolean
Forwards the call to wrappedCollection.isEmpty. | UniqueCollection | |
![]() |
Forwards the call to wrappedCollection.iterator. | UniqueCollection | |
![]() | lastIndexOf(element:*, fromIndex:int = 0x7fffffff):int
Forwards the call to wrappedList.lastIndexOf. | UniqueList | |
![]() | 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. | UniqueList | |
![]() | remove(o:*):Boolean
Forwards the call to wrappedCollection.remove. | UniqueCollection | |
![]() | removeAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.removeAll. | UniqueCollection | |
![]() | removeAt(index:int):*
Forwards the call to wrappedList.removeAt. | UniqueList | |
![]() | removeRange(fromIndex:int, toIndex:int):ICollection
Forwards the call to wrappedList.removeRange. | UniqueList | |
![]() | retainAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.retainAll. | UniqueCollection | |
![]() | reverse():void
Forwards the call to wrappedList.reverse. | UniqueList | |
![]() | setAt(index:int, element:*):*
If wrappedList.contains(element) returns true then returns false. | UniqueList | |
![]() | size():int
Forwards the call to wrappedCollection.size. | UniqueCollection | |
sort(compare:Function = null, options:uint = 0):Array
Forwards the call to wrappedList.sort. | UniqueSortedList | ||
sortOn(fieldName:*, options:* = null):Array
Forwards the call to wrappedList.sortOn. | UniqueSortedList | ||
[override]
Forwards the call to wrappedList.subList. | UniqueSortedList | ||
![]() | toArray():Array
Forwards the call to wrappedCollection.toArray. | UniqueCollection | |
![]() | toString():String
Returns the string representation of this instance. | UniqueCollection | |
| comparator | property |
comparator:IComparator
Defines the wrappedList comparator object to be used automatically to sort.
If this value change the wrappedList is automatically reordered with the new value.
public function get comparator():IComparator public function set comparator(value:IComparator):void| options | property |
options:uint
Defines the wrappedList options to be used automatically to sort.
If this value change the list is automatically reordered with the new value.
public function get options():uint public function set options(value:uint):void| UniqueSortedList | () | Constructor |
public function UniqueSortedList(wrapList:ISortedList)
Constructor, creates a new TypedList object.
wrapList:ISortedList — the target list to wrap.
|
ArgumentError — if the wrapList argument is null.
| |
ArgumentError — if the type argument is null.
| |
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in the wrapList argument are incompatible with the type argument.
|
| clone | () | method |
override public function clone():*
Creates and return a new UniqueSortedList object with the clone of the wrappedMap object.
* — a new UniqueSortedList object with the clone of the wrappedMap object.
|
| equals | () | method |
override public function equals(other:*):Boolean
Performs an arbitrary, specific evaluation of equality between this object and the other object.
This implementation considers two differente objects equal if:
This implementation takes care of the order of the elements in the list. So, for two lists are equal the order of elements returned by the iterator must be equal.
Parameters
other:* — the object to be compared for equality.
|
Boolean — true if the arbitrary evaluation considers the objects equal.
|
| sort | () | method |
public function sort(compare:Function = null, options:uint = 0):Array
Forwards the call to wrappedList.sort.
Parameters
compare:Function (default = null) | |
options:uint (default = 0) |
Array —
|
| sortOn | () | method |
public function sortOn(fieldName:*, options:* = null):Array
Forwards the call to wrappedList.sortOn.
Parameters
fieldName:* | |
options:* (default = null) |
Array —
|
| subList | () | method |
override public function subList(fromIndex:int, toIndex:int):IList
Forwards the call to wrappedList.subList.
Parameters
fromIndex:int | |
toIndex:int |
IList —
|
import org.as3collections.ISortedList;
import org.as3collections.IListIterator;
import org.as3collections.lists.SortedArrayList;
import org.as3collections.lists.UniqueSortedList;
import org.as3collections.utils.ListUtil;
var l1:ISortedList = new SortedArrayList([3, 5, 1, 7], null, Array.NUMERIC);
var list1:ISortedList = new UniqueSortedList(l1); // you can use this way
//var list1:ISortedList = ListUtil.getUniqueSortedList(l1); // or you can use this way
list1 // [1,3,5,7]
list1.size() // 4
list1.addAt(1, 4) // true
list1 // [1,3,4,5,7]
list1.size() // 5
list1.addAt(2, 3) // false
list1 // [1,3,4,5,7]
list1.size() // 5
list1.add(5) // false
list1 // [1,3,4,5,7]
list1.size() // 5