LongListKt

Added in 1.4.0

public final class LongListKt


Summary

Public methods

static final @NonNull LongList
buildLongList(
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableLongListUnit> builderAction
)

Builds a new LongList by populating a MutableLongList using the given builderAction.

static final @NonNull LongList
buildLongList(
    int initialCapacity,
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableLongListUnit> builderAction
)

Builds a new LongList by populating a MutableLongList using the given builderAction.

static final @NonNull LongList
static final @NonNull LongList
static final @NonNull LongList
longListOf(long element1)
static final @NonNull LongList
longListOf(long elements)
static final @NonNull LongList
longListOf(long element1, long element2)
static final @NonNull LongList
longListOf(long element1, long element2, long element3)
static final @NonNull MutableLongList
static final @NonNull MutableLongList
mutableLongListOf(long element1)
static final @NonNull MutableLongList
mutableLongListOf(long elements)
static final @NonNull MutableLongList
mutableLongListOf(long element1, long element2)
static final @NonNull MutableLongList
mutableLongListOf(long element1, long element2, long element3)

Public methods

buildLongList

public static final @NonNull LongList buildLongList(
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableLongListUnit> builderAction
)

Builds a new LongList by populating a MutableLongList 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 MutableLongListUnit> builderAction

Lambda in which the MutableLongList can be populated.

buildLongList

public static final @NonNull LongList buildLongList(
    int initialCapacity,
    @ExtensionFunctionType @NonNull Function1<@NonNull MutableLongListUnit> builderAction
)

Builds a new LongList by populating a MutableLongList 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 MutableLongListUnit> builderAction

Lambda in which the MutableLongList can be populated.

emptyLongList

public static final @NonNull LongList emptyLongList()
Returns
@NonNull LongList

a read-only LongList with nothing in it.

longListOf

public static final @NonNull LongList longListOf()
Returns
@NonNull LongList

a read-only LongList with nothing in it.

longListOf

public static final @NonNull LongList longListOf(long element1)
Returns
@NonNull LongList

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

longListOf

public static final @NonNull LongList longListOf(long elements)
Returns
@NonNull LongList

a new read-only LongList with elements in order.

longListOf

public static final @NonNull LongList longListOf(long element1, long element2)
Returns
@NonNull LongList

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

longListOf

public static final @NonNull LongList longListOf(long element1, long element2, long element3)
Returns
@NonNull LongList

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

mutableLongListOf

public static final @NonNull MutableLongList mutableLongListOf()
Returns
@NonNull MutableLongList

a new empty MutableLongList with the default capacity.

mutableLongListOf

public static final @NonNull MutableLongList mutableLongListOf(long element1)
Returns
@NonNull MutableLongList

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

mutableLongListOf

public static final @NonNull MutableLongList mutableLongListOf(long elements)
Returns
@NonNull MutableLongList

a new MutableLongList with the given elements, in order.

mutableLongListOf

public static final @NonNull MutableLongList mutableLongListOf(long element1, long element2)
Returns
@NonNull MutableLongList

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

mutableLongListOf

public static final @NonNull MutableLongList mutableLongListOf(long element1, long element2, long element3)
Returns
@NonNull MutableLongList

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