# TimestampIterator

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/TimestampIterator.java+class:androidx.media3.common.util.TimestampIterator)

*** ** * ** ***


```
@UnstableApi
public interface TimestampIterator
```

<br />

Known direct subclasses [ConstantRateTimestampIterator](https://developer.android.com/reference/androidx/media3/common/util/ConstantRateTimestampIterator)

|---|---|
| `https://developer.android.com/reference/androidx/media3/common/util/ConstantRateTimestampIterator` | A `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator` that generates monotonically increasing timestamps (in microseconds) distributed evenly over the given `durationUs` based on the given `frameRate`. |

*** ** * ** ***

A primitive long iterator used for generating sequences of timestamps.

## Summary

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator` | `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator#copyOf()()` Returns fresh copy of the iterator. |
| `default long` | `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator#getLastTimestampUs()()` Returns the last (final) timestamp this iterator generates, in microseconds. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator#hasNext()()` Returns whether there is another element. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator#next()()` Returns the next timestamp. |

## Public methods

### copyOf

```
abstract TimestampIterator copyOf()
```

Returns fresh copy of the iterator.

### getLastTimestampUs

```
default long getLastTimestampUs()
```

Returns the last (final) timestamp this iterator generates, in microseconds.

This method returns `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the last timestamp is unknown, or when no timestamp will be generated.

### hasNext

```
abstract boolean hasNext()
```

Returns whether there is another element.

### next

```
abstract long next()
```

Returns the next timestamp.