{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

MutableVectorKt

public final class MutableVectorKt


Summary

Public methods

static final @NonNull MutableVector<@NonNull T>
<T extends Object> MutableVector(int capacity)

Create a MutableVector with a given initial capacity.

static final @NonNull MutableVector<@NonNull T>
<T extends Object> MutableVector(
    int size,
    @NonNull Function1<@NonNull Integer, @NonNull T> init
)

Create a MutableVector with a given size, initializing each element using the init function.

static final @NonNull MutableVector<@NonNull T>
<T extends Object> mutableVectorOf()

Creates an empty MutableVector with a capacity of 16.

static final @NonNull MutableVector<@NonNull T>
<T extends Object> mutableVectorOf(@NonNull T elements)

Creates a MutableVector with the given values.

Public methods

MutableVector

public static final @NonNull MutableVector<@NonNull T> <T extends Object> MutableVector(int capacity)

Create a MutableVector with a given initial capacity.

See also
ensureCapacity

MutableVector

public static final @NonNull MutableVector<@NonNull T> <T extends Object> MutableVector(
    int size,
    @NonNull Function1<@NonNull Integer, @NonNull T> init
)

Create a MutableVector with a given size, initializing each element using the init function.

init is called for each element in the MutableVector, starting from the first one and should return the value to be assigned to the element at its given index.

mutableVectorOf

public static final @NonNull MutableVector<@NonNull T> <T extends Object> mutableVectorOf()

Creates an empty MutableVector with a capacity of 16.

mutableVectorOf

public static final @NonNull MutableVector<@NonNull T> <T extends Object> mutableVectorOf(@NonNull T elements)

Creates a MutableVector with the given values. This will use the passed vararg elements storage.