# IntSet

# IntSet

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/collection/IntSet "View this page in Java")
Common/AllAndroid/JVMNative/C/iOSJavaScript
  - Cmn  

  ```
  sealed class IntSet
```  
Known direct subclasses  
[MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet)  

|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet) | [MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet)is a container with a[MutableSet](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)-like interface based on a flat hash table implementation. |

*** ** * ** ***

[IntSet](https://developer.android.com/reference/kotlin/androidx/collection/IntSet)is a container with a[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)-like interface designed to avoid allocations, including boxing.

This implementation makes no guarantee as to the order of the elements, nor does it make guarantees that the order remains constant over time.

Though[IntSet](https://developer.android.com/reference/kotlin/androidx/collection/IntSet)offers a read-only interface, it is always backed by a[MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet). Read operations alone are thread-safe. However, any mutations done through the backing[MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet)while reading on another thread are not safe and the developer must protect the set from such changes during read operations.  

|                                             See also                                              |
|---------------------------------------------------------------------------------------------------|---|
| [MutableIntSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableIntSet) |   |

## Summary

|                                    ### Protected constructors                                    |
|--------------------------------------------------------------------------------------------------|-----|
| [IntSet](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#IntSet())`()` | Cmn |

|                                                                                   ### Public functions                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `inline `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                              | [all](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#all(kotlin.Function1))`(predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Returns true if all elements match the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#all(kotlin.Function1)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                       | [any](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#any())`()` Returns`true`if this set has at least one element.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Cmn |
| `inline `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                              | [any](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#any(kotlin.Function1))`(predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Returns true if at least one element matches the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#any(kotlin.Function1)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Cmn |
| `operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                            | [contains](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#contains(kotlin.Int))`(element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns`true`if the specified[element](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#contains(kotlin.Int))is present in this set,`false`otherwise.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Cmn |
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | [count](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#count())`()` Returns the number of elements in this set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Cmn |
| `inline @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [count](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#count(kotlin.Function1))`(predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Returns the number of elements matching the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#count(kotlin.Function1)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Cmn |
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                       | [equals](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Compares the specified object[other](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#equals(kotlin.Any))with this set for equality.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Cmn |
| `inline `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                      | [first](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first())`()` Returns the first element in the collection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Cmn |
| `inline `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                      | [first](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))`(predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Returns the first element in the collection for which[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))returns`true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Cmn |
| `inline `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                    | [forEach](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#forEach(kotlin.Function1))`(block: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)`)` Iterates over every element stored in this set by invoking the specified[block](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#forEach(kotlin.Function1))lambda.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Cmn |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                        | [hashCode](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#hashCode())`()` Returns the hash code value for this set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                       | [isEmpty](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#isEmpty())`()` Indicates whether this set is empty.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                       | [isNotEmpty](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#isNotEmpty())`()` Returns`true`if this set is not empty.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Cmn |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                         | [joinToString](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))`(` ` separator: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` prefix: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` postfix: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` limit: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` truncated: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) `)` Creates a String from the elements separated by[separator](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))and using[prefix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))before and[postfix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))after, if supplied.                                                                                                                                                                                                                                                                                      | Cmn |
| `inline `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                | [joinToString](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))`(` ` separator: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` prefix: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` postfix: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` limit: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` truncated: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` crossinline transform: (`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) `)` Creates a String from the elements separated by[separator](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))and using[prefix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))before and[postfix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))after, if supplied. | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                       | [none](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#none())`()` Returns`true`if this set has no elements.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Cmn |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                  | [toString](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#toString())`()` Returns a string representation of this set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Cmn |

|                            ### Public properties                            |
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [capacity](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#capacity()) Returns the number of elements that can be stored in this set without requiring internal storage reallocation. | Cmn |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [size](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#size()) Returns the number of elements in this set.                                                                            | Cmn |

## Protected constructors

### IntSet

Cmn  

```
protected IntSet()
```

## Public functions

### all

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun all(predicate: (element: Int) -> Boolean): Boolean
```

Returns true if all elements match the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#all(kotlin.Function1)).  

|                                                                                           Parameters                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| `predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | called for elements in the set to determine if it returns return`true`for all elements. |

### any

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun any(): Boolean
```

Returns`true`if this set has at least one element.  

### any

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun any(predicate: (element: Int) -> Boolean): Boolean
```

Returns true if at least one element matches the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#any(kotlin.Function1)).  

|                                                                                           Parameters                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| `predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | called for elements in the set to determine if it returns`true`for any elements. |

### contains

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
operator fun contains(element: Int): Boolean
```

Returns`true`if the specified[element](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#contains(kotlin.Int))is present in this set,`false`otherwise.  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|-------------------------------------|
| `element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The element to look for in this set |

### count

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun count(): @IntRange(from = 0) Int
```

Returns the number of elements in this set.  

### count

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun count(predicate: (element: Int) -> Boolean): @IntRange(from = 0) Int
```

Returns the number of elements matching the given[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#count(kotlin.Function1)).  

|                                                                                           Parameters                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| `predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Called for all elements in the set to count the number for which it returns`true`. |

### equals

Cmn  

```
open operator fun equals(other: Any?): Boolean
```

Compares the specified object[other](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#equals(kotlin.Any))with this set for equality. The two objects are considered equal if[other](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#equals(kotlin.Any)):

- Is a[IntSet](https://developer.android.com/reference/kotlin/androidx/collection/IntSet)

- Has the same[size](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#size())as this set

- Contains elements equal to this set's elements

### first

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun first(): Int
```

Returns the first element in the collection.  

|                                                           Throws                                                            |
|-----------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [kotlin.NoSuchElementException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html) | if the collection is empty |

### first

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun first(predicate: (element: Int) -> Boolean): Int
```

Returns the first element in the collection for which[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))returns`true`.

**Note** There is no mechanism for both determining if there is an element that matches[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))*and* returning it if it exists. Developers should use[forEach](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#forEach(kotlin.Function1))to achieve this behavior.  

|                                                                                           Parameters                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| `predicate: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Called on elements of the set, returning`true`for an element that matches or`false`if it doesn't |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | An element in the set for which[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))returns`true`. |

|                                                           Throws                                                            |
|-----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.NoSuchElementException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html) | if[predicate](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#first(kotlin.Function1))returns`false`for all elements or the collection is empty. |

### forEach

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
inline fun forEach(block: (element: Int) -> Unit): Unit
```

Iterates over every element stored in this set by invoking the specified[block](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#forEach(kotlin.Function1))lambda.  

|                                                                                      Parameters                                                                                      |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| `block: (element: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`) `->` `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | called with each element in the set |

### hashCode

Cmn  

```
open fun hashCode(): Int
```

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set.  

### isEmpty

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun isEmpty(): Boolean
```

Indicates whether this set is empty.  

### isNotEmpty

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun isNotEmpty(): Boolean
```

Returns`true`if this set is not empty.  

### joinToString

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun joinToString(
    separator: CharSequence = ", ",
    prefix: CharSequence = "",
    postfix: CharSequence = "",
    limit: Int = -1,
    truncated: CharSequence = "..."
): String
```

Creates a String from the elements separated by[separator](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))and using[prefix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))before and[postfix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))after, if supplied.

When a non-negative value of[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))is provided, a maximum of[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))items are used to generate the string. If the collection holds more than[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence))items, the string is terminated with[truncated](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)).  

### joinToString

Cmn  

```
inline fun joinToString(
    separator: CharSequence = ", ",
    prefix: CharSequence = "",
    postfix: CharSequence = "",
    limit: Int = -1,
    truncated: CharSequence = "...",
    crossinline transform: (Int) -> CharSequence
): String
```

Creates a String from the elements separated by[separator](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))and using[prefix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))before and[postfix](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))after, if supplied.[transform](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))dictates how each element will be represented.

When a non-negative value of[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))is provided, a maximum of[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))items are used to generate the string. If the collection holds more than[limit](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1))items, the string is terminated with[truncated](https://developer.android.com/reference/kotlin/androidx/collection/IntSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)).  

### none

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
fun none(): Boolean
```

Returns`true`if this set has no elements.  

### toString

Cmn  

```
open fun toString(): String
```

Returns a string representation of this set. The set is denoted in the string by the`{}`. Each element is separated by`, `.

## Public properties

### capacity

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
val capacity: Int
```

Returns the number of elements that can be stored in this set without requiring internal storage reallocation.  

### size

Cmn  
Added in[1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)  

```
val size: Int
```

Returns the number of elements in this set.