A Vector is a storage of fixed size. It can be faster than Array on some targets, and is never slower.

See also:

Static variables

staticread onlylength:Int

Returns the length of this Vector.

Static methods

staticblit<T>(src:Vector<T>, srcPos:Int, dest:Vector<T>, destPos:Int, len:Int):Void

Copies length of elements from src Vector, beginning at srcPos to dest Vector, beginning at destPos

The results are unspecified if length results in out-of-bounds access, or if src or dest are null

staticinlinecopy<T>(this:VectorData<T>):Vector<T>

Returns a shallow copy of this Vector.

The elements are not copied and retain their identity, so a[i] == a.copy()[i] is true for any valid i. However, a == a.copy() is always false.

staticinlinefromArrayCopy<T>(array:Array<T>):Vector<T>

Creates a new Vector by copying the elements of array.

This always creates a copy, even on platforms where the internal representation is Array.

The elements are not copied and retain their identity, so a[i] == Vector.fromArrayCopy(a).get(i) is true for any valid i.

If array is null, the result is unspecified.

staticinlinefromData<T>(data:VectorData<T>):Vector<T>

Initializes a new Vector from data.

Since data is the internal representation of Vector, this is a no-op.

If data is null, the corresponding Vector is also null.

@:op([])staticinlineget(this:VectorData<T>, index:Int):T

Returns the value at index index.

If index is negative or exceeds this.length, the result is unspecified.

staticjoin<T>(this:VectorData<T>, sep:String):String

Returns a string representation of this Vector, with sep separating each element.

The result of this operation is equal to Std.string(this[0]) + sep + Std.string(this[1]) + sep + ... + sep + Std.string(this[this.length-1])

If this Vector has length 0, the result is the empty String "". If this has exactly one element, the result is equal to a call to Std.string(this[0]).

If sep is null, the result is unspecified.

staticinlinemap<S>(this:VectorData<T>, f:T ‑> S):Vector<S>

Creates a new Vector by applying function f to all elements of this.

The order of elements is preserved.

If f is null, the result is unspecified.

@:op([])staticinlineset(this:VectorData<T>, index:Int, val:T):T

Sets the value at index index to val.

If index is negative or exceeds this.length, the result is unspecified.

staticinlinesort(this:VectorData<T>, f:(T, T) ‑> Int):Void

Available on python, js, neko, hl, cs, lua, flash, cpp, macro, java

Sorts this Vector according to the comparison function f, where f(x,y) returns 0 if x == y, a positive Int if x > y and a negative Int if x < y.

This operation modifies this Vector in place.

The sort operation is not guaranteed to be stable, which means that the order of equal elements may not be retained.

If f is null, the result is unspecified.

staticinlinesort<T>(this:VectorData<T>, f:(T, T) ‑> Int):Void

Available on php

Sorts this Vector according to the comparison function f, where f(x,y) returns 0 if x == y, a positive Int if x > y and a negative Int if x < y.

This operation modifies this Vector in place.

The sort operation is not guaranteed to be stable, which means that the order of equal elements may not be retained.

If f is null, the result is unspecified.

statictoArray(this:VectorData<T>):Array<T>

Creates a new Array, copy the content from the Vector to it, and returns it.

staticinlinetoData(this:VectorData<T>):VectorData<T>

Extracts the data of this Vector.

This returns the internal representation type.