IntListKt

Added in 1.4.0

public final class IntListKt


Summary

Public methods

static final @NonNull IntList
buildIntList(
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction
)

Builds a new IntList by populating a MutableIntList using the given builderAction.

static final @NonNull IntList
buildIntList(
    int initialCapacity,
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction
)

Builds a new IntList by populating a MutableIntList using the given builderAction.

static final @NonNull IntList
static final @NonNull IntList
static final @NonNull IntList
intListOf(int element1)
static final @NonNull IntList
intListOf(int elements)
static final @NonNull IntList
intListOf(int element1, int element2)
static final @NonNull IntList
intListOf(int element1, int element2, int element3)
static final @NonNull MutableIntList
static final @NonNull MutableIntList
mutableIntListOf(int element1)
static final @NonNull MutableIntList
mutableIntListOf(int elements)
static final @NonNull MutableIntList
mutableIntListOf(int element1, int element2)
static final @NonNull MutableIntList
mutableIntListOf(int element1, int element2, int element3)

Public methods

buildIntList

public static final @NonNull IntList buildIntList(
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction
)

Builds a new IntList by populating a MutableIntList using the given builderAction.

The instance passed as a receiver to the builderAction is valid only inside that function. Using it outside of the function produces an unspecified behavior.

Parameters
@ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction

Lambda in which the MutableIntList can be populated.

buildIntList

public static final @NonNull IntList buildIntList(
    int initialCapacity,
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction
)

Builds a new IntList by populating a MutableIntList using the given builderAction.

The instance passed as a receiver to the builderAction is valid only inside that function. Using it outside of the function produces an unspecified behavior.

Parameters
int initialCapacity

Hint for the expected number of elements added in the builderAction.

@ExtensionFunctionType @NonNull Function1<@NonNull MutableIntListUnit> builderAction

Lambda in which the MutableIntList can be populated.

emptyIntList

public static final @NonNull IntList emptyIntList()
Returns
@NonNull IntList

a read-only IntList with nothing in it.

intListOf

public static final @NonNull IntList intListOf()
Returns
@NonNull IntList

a read-only IntList with nothing in it.

intListOf

public static final @NonNull IntList intListOf(int element1)
Returns
@NonNull IntList

a new read-only IntList with element1 as the only item in the list.

intListOf

public static final @NonNull IntList intListOf(int elements)
Returns
@NonNull IntList

a new read-only IntList with elements in order.

intListOf

public static final @NonNull IntList intListOf(int element1, int element2)
Returns
@NonNull IntList

a new read-only IntList with 2 elements, element1 and element2, in order.

intListOf

public static final @NonNull IntList intListOf(int element1, int element2, int element3)
Returns
@NonNull IntList

a new read-only IntList with 3 elements, element1, element2, and element3, in order.

mutableIntListOf

public static final @NonNull MutableIntList mutableIntListOf()
Returns
@NonNull MutableIntList

a new empty MutableIntList with the default capacity.

mutableIntListOf

public static final @NonNull MutableIntList mutableIntListOf(int element1)
Returns
@NonNull MutableIntList

a new MutableIntList with element1 as the only item in the list.

mutableIntListOf

public static final @NonNull MutableIntList mutableIntListOf(int elements)
Returns
@NonNull MutableIntList

a new MutableIntList with the given elements, in order.

mutableIntListOf

public static final @NonNull MutableIntList mutableIntListOf(int element1, int element2)
Returns
@NonNull MutableIntList

a new MutableIntList with 2 elements, element1 and element2, in order.

mutableIntListOf

public static final @NonNull MutableIntList mutableIntListOf(int element1, int element2, int element3)
Returns
@NonNull MutableIntList

a new MutableIntList with 3 elements, element1, element2, and element3, in order.