# LongSetKt

Added in 1.4.0

*** ** * ** ***


```
public final class LongSetKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#buildLongSet(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builderAction )` Builds a new `https://developer.android.com/reference/androidx/collection/LongSet` by populating a `https://developer.android.com/reference/androidx/collection/MutableLongSet` using the given `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Function1)`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#buildLongSet(kotlin.Int,kotlin.Function1)( int initialCapacity, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builderAction )` Builds a new `https://developer.android.com/reference/androidx/collection/LongSet` by populating a `https://developer.android.com/reference/androidx/collection/MutableLongSet` using the given `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Int,kotlin.Function1)`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#emptyLongSet()()` Returns an empty, read-only `https://developer.android.com/reference/androidx/collection/LongSet`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#longSetOf()()` Returns an empty, read-only `https://developer.android.com/reference/androidx/collection/ScatterSet`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#longSetOf(kotlin.Long)(long element1)` Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#longSetOf(kotlin.LongArray)(long... elements)` Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.LongArray)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#longSetOf(kotlin.Long,kotlin.Long)(long element1, long element2)` Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long)` and `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)(long element1, long element2, long element3)` Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, and `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#mutableLongSetOf()()` Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#mutableLongSetOf(kotlin.Long)(long element1)` Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#mutableLongSetOf(kotlin.LongArray)(long... elements)` Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with the specified elements. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#mutableLongSetOf(kotlin.Long,kotlin.Long)(long element1, long element2)` Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long)` and `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long)` in it. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet` | `https://developer.android.com/reference/androidx/collection/LongSetKt#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)(long element1, long element2, long element3)` Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, and `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)` in it. |

## Public methods

### buildLongSet

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:buildLongSet) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
public static final @NonNull LongSet buildLongSet(
    @NonNull Function1<@NonNull MutableLongSet, Unit> builderAction
)
```

Builds a new `https://developer.android.com/reference/androidx/collection/LongSet` by populating a `https://developer.android.com/reference/androidx/collection/MutableLongSet` using the given `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Function1)`.

The set passed as a receiver to the `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Function1)` is valid only inside that function. Using it outside of the function produces an unspecified behavior.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builderAction` | Lambda in which the `https://developer.android.com/reference/androidx/collection/MutableLongSet` can be populated. |

### buildLongSet

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:buildLongSet) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
public static final @NonNull LongSet buildLongSet(
    int initialCapacity,
    @NonNull Function1<@NonNull MutableLongSet, Unit> builderAction
)
```

Builds a new `https://developer.android.com/reference/androidx/collection/LongSet` by populating a `https://developer.android.com/reference/androidx/collection/MutableLongSet` using the given `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Int,kotlin.Function1)`.

The set passed as a receiver to the `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Int,kotlin.Function1)` 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 `https://developer.android.com/reference/androidx/collection/package-summary#buildLongSet(kotlin.Int,kotlin.Function1)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/MutableLongSet, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builderAction` | Lambda in which the `https://developer.android.com/reference/androidx/collection/MutableLongSet` can be populated. |

### emptyLongSet

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:emptyLongSet) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet emptyLongSet()
```

Returns an empty, read-only `https://developer.android.com/reference/androidx/collection/LongSet`.

### longSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:longSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet longSetOf()
```

Returns an empty, read-only `https://developer.android.com/reference/androidx/collection/ScatterSet`.

### longSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:longSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet longSetOf(long element1)
```

Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long)` in it.

### longSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:longSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet longSetOf(long... elements)
```

Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.LongArray)` in it.

### longSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:longSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet longSetOf(long element1, long element2)
```

Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long)` and `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long)` in it.

### longSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:longSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull LongSet longSetOf(long element1, long element2, long element3)
```

Returns a new read-only `https://developer.android.com/reference/androidx/collection/LongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, and `https://developer.android.com/reference/androidx/collection/package-summary#longSetOf(kotlin.Long,kotlin.Long,kotlin.Long)` in it.

### mutableLongSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:mutableLongSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull MutableLongSet mutableLongSetOf()
```

Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet`.

### mutableLongSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:mutableLongSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull MutableLongSet mutableLongSetOf(long element1)
```

Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long)` in it.

### mutableLongSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:mutableLongSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull MutableLongSet mutableLongSetOf(long... elements)
```

Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with the specified elements.

### mutableLongSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:mutableLongSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull MutableLongSet mutableLongSetOf(long element1, long element2)
```

Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long)` and `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long)` in it.

### mutableLongSetOf

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/LongSet.kt+function:mutableLongSetOf) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public static final @NonNull MutableLongSet mutableLongSetOf(long element1, long element2, long element3)
```

Returns a new `https://developer.android.com/reference/androidx/collection/MutableLongSet` with only `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)`, and `https://developer.android.com/reference/androidx/collection/package-summary#mutableLongSetOf(kotlin.Long,kotlin.Long,kotlin.Long)` in it.