# Spliterator.OfInt

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Constants](https://developer.android.com/reference/java/util/Spliterator.OfInt#inhconstants)\|[Methods](https://developer.android.com/reference/java/util/Spliterator.OfInt#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/Spliterator.OfInt#inhmethods)  

# Spliterator.OfInt

`
public
static


interface
Spliterator.OfInt
`  
`


implements

`[OfPrimitive](https://developer.android.com/reference/java/util/Spliterator.OfPrimitive)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`, `[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)`, `[Spliterator.OfInt](https://developer.android.com/reference/java/util/Spliterator.OfInt)`>


`

|-----------------------------|
| java.util.Spliterator.OfInt |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [Spliterators.AbstractIntSpliterator](https://developer.android.com/reference/java/util/Spliterators.AbstractIntSpliterator) |------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------| | [Spliterators.AbstractIntSpliterator](https://developer.android.com/reference/java/util/Spliterators.AbstractIntSpliterator) | An abstract`Spliterator.OfInt`that implements`trySplit`to permit limited parallelism. | |

<br />

*** ** * ** ***

A Spliterator specialized for`int`values.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[java.util.Spliterator](https://developer.android.com/reference/java/util/Spliterator) |-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONCURRENT](https://developer.android.com/reference/java/util/Spliterator#CONCURRENT) Characteristic value signifying that the element source may be safely concurrently modified (allowing additions, replacements, and/or removals) by multiple threads without external synchronization.                                                                                     | | `int` | [DISTINCT](https://developer.android.com/reference/java/util/Spliterator#DISTINCT) Characteristic value signifying that, for each pair of encountered elements`x, y`,`!x.equals(y)`.                                                                                                                                                                                             | | `int` | [IMMUTABLE](https://developer.android.com/reference/java/util/Spliterator#IMMUTABLE) Characteristic value signifying that the element source cannot be structurally modified; that is, elements cannot be added, replaced, or removed, so such changes cannot occur during traversal.                                                                                            | | `int` | [NONNULL](https://developer.android.com/reference/java/util/Spliterator#NONNULL) Characteristic value signifying that the source guarantees that encountered elements will not be`null`.                                                                                                                                                                                         | | `int` | [ORDERED](https://developer.android.com/reference/java/util/Spliterator#ORDERED) Characteristic value signifying that an encounter order is defined for elements.                                                                                                                                                                                                                | | `int` | [SIZED](https://developer.android.com/reference/java/util/Spliterator#SIZED) Characteristic value signifying that the value returned from`estimateSize()`prior to traversal or splitting represents a finite size that, in the absence of structural source modification, represents an exact count of the number of elements that would be encountered by a complete traversal. | | `int` | [SORTED](https://developer.android.com/reference/java/util/Spliterator#SORTED) Characteristic value signifying that encounter order follows a defined sort order.                                                                                                                                                                                                                | | `int` | [SUBSIZED](https://developer.android.com/reference/java/util/Spliterator#SUBSIZED) Characteristic value signifying that all Spliterators resulting from`trySplit()`will be both[SIZED](https://developer.android.com/reference/java/util/Spliterator#SIZED)and[SUBSIZED](https://developer.android.com/reference/java/util/Spliterator#SUBSIZED).                                | |

|                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                         ||
|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` default void`                                                                                      | ` `[forEachRemaining](https://developer.android.com/reference/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.Consumer<?%20super%20java.lang.Integer>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super `[Integer](https://developer.android.com/reference/java/lang/Integer)`> action) ` <br /> |
| ` default void`                                                                                      | ` `[forEachRemaining](https://developer.android.com/reference/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.IntConsumer))`(`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` action) `                                                                                                              |
| ` default boolean`                                                                                   | ` `[tryAdvance](https://developer.android.com/reference/java/util/Spliterator.OfInt#tryAdvance(java.util.function.Consumer<?%20super%20java.lang.Integer>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super `[Integer](https://developer.android.com/reference/java/lang/Integer)`> action) ` <br />             |
| ` abstract boolean`                                                                                  | ` `[tryAdvance](https://developer.android.com/reference/java/util/Spliterator.OfInt#tryAdvance(java.util.function.IntConsumer))`(`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` action) `                                                                                                                          |
| ` abstract `[Spliterator.OfInt](https://developer.android.com/reference/java/util/Spliterator.OfInt) | ` `[trySplit](https://developer.android.com/reference/java/util/Spliterator.OfInt#trySplit())`() ` If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[java.util.Spliterator.OfPrimitive](https://developer.android.com/reference/java/util/Spliterator.OfPrimitive)` ` |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void`      | ` `[forEachRemaining](https://developer.android.com/reference/java/util/Spliterator.OfPrimitive#forEachRemaining(T_CONS))`(`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` action) ` Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. | | ` abstract boolean`  | ` `[tryAdvance](https://developer.android.com/reference/java/util/Spliterator.OfPrimitive#tryAdvance(T_CONS))`(`[IntConsumer](https://developer.android.com/reference/java/util/function/IntConsumer)` action) ` If a remaining element exists, performs the given action on it, returning`true`; else returns`false`.                                                                           | | ` abstract T_SPLITR` | ` `[trySplit](https://developer.android.com/reference/java/util/Spliterator.OfPrimitive#trySplit())`() ` If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.                                                                                                                           | ||
| From interface` `[java.util.Spliterator](https://developer.android.com/reference/java/util/Spliterator)` ` |--------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`                                                                                                                                                    | ` `[characteristics](https://developer.android.com/reference/java/util/Spliterator#characteristics())`() ` Returns a set of characteristics of this Spliterator and its elements.                                                                                                                                                                                                                                                                                                                  | | ` abstract long`                                                                                                                                                   | ` `[estimateSize](https://developer.android.com/reference/java/util/Spliterator#estimateSize())`() ` Returns an estimate of the number of elements that would be encountered by a[forEachRemaining(Consumer)](https://developer.android.com/reference/java/util/Spliterator#forEachRemaining(java.util.function.Consumer<?%20super%20T>))traversal, or returns[Long.MAX_VALUE](https://developer.android.com/reference/java/lang/Long#MAX_VALUE)if infinite, unknown, or too expensive to compute. | | ` default void`                                                                                                                                                    | ` `[forEachRemaining](https://developer.android.com/reference/java/util/Spliterator#forEachRemaining(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action) ` Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.                                                                      | | ` default `[Comparator](https://developer.android.com/reference/java/util/Comparator)`<? super T>`                                                                 | ` `[getComparator](https://developer.android.com/reference/java/util/Spliterator#getComparator())`() ` If this Spliterator's source is[SORTED](https://developer.android.com/reference/java/util/Spliterator#SORTED)by a[Comparator](https://developer.android.com/reference/java/util/Comparator), returns that`Comparator`.                                                                                                                                                                      | | ` default long`                                                                                                                                                    | ` `[getExactSizeIfKnown](https://developer.android.com/reference/java/util/Spliterator#getExactSizeIfKnown())`() ` Convenience method that returns[estimateSize()](https://developer.android.com/reference/java/util/Spliterator#estimateSize())if this Spliterator is[SIZED](https://developer.android.com/reference/java/util/Spliterator#SIZED), else`-1`.                                                                                                                                      | | ` default boolean`                                                                                                                                                 | ` `[hasCharacteristics](https://developer.android.com/reference/java/util/Spliterator#hasCharacteristics(int))`(int characteristics) ` Returns`true`if this Spliterator's[characteristics()](https://developer.android.com/reference/java/util/Spliterator#characteristics())contain all of the given characteristics.                                                                                                                                                                             | | ` abstract boolean`                                                                                                                                                | ` `[tryAdvance](https://developer.android.com/reference/java/util/Spliterator#tryAdvance(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action) ` If a remaining element exists: performs the given action on it, returning`true`; else returns`false`.                                                                                                                                                | | ` abstract `[Spliterator](https://developer.android.com/reference/java/util/Spliterator)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`>` | ` `[trySplit](https://developer.android.com/reference/java/util/Spliterator#trySplit())`() ` If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.                                                                                                                                                                                                                                         | ||

## Public methods

### forEachRemaining

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void forEachRemaining (Consumer<? super Integer> action)
```

<br />

<br />

##### Implementation Requirements:

- If the action is an instance of`IntConsumer`then it is cast to`IntConsumer`and passed to[forEachRemaining(java.util.function.IntConsumer)](https://developer.android.com/reference/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.IntConsumer)); otherwise the action is adapted to an instance of`IntConsumer`, by boxing the argument of`IntConsumer`, and then passed to[forEachRemaining(java.util.function.IntConsumer)](https://developer.android.com/reference/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.IntConsumer)).

|         Parameters          ||
|----------|-------------------|
| `action` | `Consumer` <br /> |

### forEachRemaining

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void forEachRemaining (IntConsumer action)
```

<br />

<br />

|           Parameters           ||
|----------|----------------------|
| `action` | `IntConsumer` <br /> |

### tryAdvance

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean tryAdvance (Consumer<? super Integer> action)
```

<br />

<br />

##### Implementation Requirements:

- If the action is an instance of`IntConsumer`then it is cast to`IntConsumer`and passed to[tryAdvance(java.util.function.IntConsumer)](https://developer.android.com/reference/java/util/Spliterator.OfInt#tryAdvance(java.util.function.IntConsumer)); otherwise the action is adapted to an instance of`IntConsumer`, by boxing the argument of`IntConsumer`, and then passed to[tryAdvance(java.util.function.IntConsumer)](https://developer.android.com/reference/java/util/Spliterator.OfInt#tryAdvance(java.util.function.IntConsumer)).

|         Parameters          ||
|----------|-------------------|
| `action` | `Consumer` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### tryAdvance

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean tryAdvance (IntConsumer action)
```

<br />

<br />

|           Parameters           ||
|----------|----------------------|
| `action` | `IntConsumer` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### trySplit

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Spliterator.OfInt trySplit ()
```

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

If this Spliterator is[ORDERED](https://developer.android.com/reference/java/util/Spliterator#ORDERED), the returned Spliterator must cover a strict prefix of the elements.

Unless this Spliterator covers an infinite number of elements, repeated calls to`trySplit()`must eventually return`null`. Upon non-null return:

- the value reported for`estimateSize()`before splitting, must, after splitting, be greater than or equal to`estimateSize()`for this and the returned Spliterator; and
- if this Spliterator is`SUBSIZED`, then`estimateSize()`for this spliterator before splitting must be equal to the sum of`estimateSize()`for this and the returned Spliterator after splitting.

This method may return`null`for any reason, including emptiness, inability to split after traversal has commenced, data structure constraints, and efficiency considerations.

<br />

|                                                                                              Returns                                                                                              ||
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| [Spliterator.OfInt](https://developer.android.com/reference/java/util/Spliterator.OfInt) | a`Spliterator`covering some portion of the elements, or`null`if this spliterator cannot be split <br /> |