All Bundles
CompareVector<H:Compare>
Growable array of comparable generics
Operations
New
Default constructor
New()
Copy constructor
New(values:H[])
Parameters
Name | Type | Description |
---|
values | H | values to copy |
Copy constructor
New(values:Vector<H>)
Parameters
Name | Type | Description |
---|
values | Vector<H> | values to copy |
AddBack
Adds a vector of values to the end of the vector
method : public : AddBack(values:Vector<H>) ~ Nil
Parameters
Name | Type | Description |
---|
values | Vector<H> | values to append |
Adds a value to the end
method : public : AddBack(value:H) ~ Nil
Parameters
Name | Type | Description |
---|
value | H | value to append |
BinarySearch
Performs a binary search O(log n)
method : public : native : BinarySearch(value:H) ~ Int
Parameters
Name | Type | Description |
---|
value | H | value to search for |
Return
Type | Description |
---|
Int | index of found value, -1 if not found |
Compress
Compresses the Vector freeing unused memory
method : public : Compress() ~ Nil
Each
Function called for each element
method : public : Each(f:(H)~Nil) ~ CompareVector<H>
Parameters
Name | Type | Description |
---|
f | (H)~Nil | function called |
Empty
Clears the vector
method : public : Empty() ~ Nil
Filter
Uses the given function to filter out values
method : public : Filter(f:(H)~Bool) ~ CompareVector<H>
Parameters
Name | Type | Description |
---|
f | (H)~Bool | function to use a filter. If the function evaluates to true the value is added to the collection. |
Return
Find
Finds a given value in the vector via linear search
method : public : Find(value:H) ~ Int
Parameters
Name | Type | Description |
---|
value | H | value to search for |
Return
Type | Description |
---|
Int | index of found value, -1 if not found |
Get
Gets an indexed value
method : public : Get(index:Int) ~ H
Parameters
Name | Type | Description |
---|
index | Int | index |
Return
Has
Check of the given value is in the vector
method : public : Has(value:H) ~ Bool
Parameters
Name | Type | Description |
---|
value | H | value to check for |
Return
Type | Description |
---|
Bool | true if found, false otherwise |
IsEmpty
Checks to see if the vector is empty
method : public : IsEmpty() ~ Bool
Return
Type | Description |
---|
Bool | true if empty, false otherwise |
Limit
Returns a limited list
method : public : Limit(l:Int) ~ CompareVector<H>
Parameters
Name | Type | Description |
---|
l | Int | limit |
Return
Map
Maps the given function to each value in the vector
method : public : Map(f:(H)~H) ~ CompareVector<H>
Parameters
Name | Type | Description |
---|
f | (H)~H | function to apply |
Return
Remove
Removes an indexed value
method : public : Remove(i:Int) ~ H
Parameters
Name | Type | Description |
---|
i | Int | index |
Return
RemoveBack
Removes the last value
method : public : RemoveBack() ~ H
Return
Set
Sets an indexed value
method : public : Set(value:H, index:Int) ~ Bool
Parameters
Name | Type | Description |
---|
value | H | value |
index | Int | index |
Size
Size of vector
method : public : Size() ~ Int
Return
Type | Description |
---|
Int | size of vector |
Sort
Sorts the values in the vector
method : public : native : Sort() ~ Nil
ToArray
Converts the vector into an object array
method : public : ToArray() ~ H[]
Return
Type | Description |
---|
H | object array |