# RankingDataComparator

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

*** ** * ** ***


```
@UnstableApi
public interface RankingDataComparator<T> extends Comparator<T>
```

<br />

Known direct subclasses [DefaultPreloadManager.SimpleRankingDataComparator](https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/DefaultPreloadManager.SimpleRankingDataComparator)

|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/DefaultPreloadManager.SimpleRankingDataComparator` | A `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator` which compares the ranks of the media items based on their distances to the `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/DefaultPreloadManager.SimpleRankingDataComparator#setCurrentPlayingIndex(int)`. |

*** ** * ** ***

A comparator of ranking data.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener` Notified when the `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator` has its state changed and the ranking has become invalid. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator#setInvalidationListener(androidx.media3.exoplayer.source.preload.RankingDataComparator.InvalidationListener)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener invalidationListener )` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener`. |

### Inherited methods

From [java.util.Comparator](https://developer.android.com/reference/java/util/Comparator.html) `abstract int` `https://developer.android.com/reference/java/util/Comparator.html#compare(T, T)(T p, T p1)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T, U extends https://developer.android.com/reference/java/lang/Comparable.html<U>> https://developer.android.com/reference/java/util/Comparator.html#comparing(java.util.function.Function&lt;? super T,? extends U&gt;)(https://developer.android.com/reference/java/util/function/Function.html<T, U> keyExtractor)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T> https://developer.android.com/reference/java/util/Comparator.html#comparingDouble(java.util.function.ToDoubleFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToDoubleFunction.html<T> keyExtractor)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T> https://developer.android.com/reference/java/util/Comparator.html#comparingInt(java.util.function.ToIntFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToIntFunction.html<T> keyExtractor)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T> https://developer.android.com/reference/java/util/Comparator.html#comparingLong(java.util.function.ToLongFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToLongFunction.html<T> keyExtractor)` `abstract boolean` `https://developer.android.com/reference/java/util/Comparator.html#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html p)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T extends https://developer.android.com/reference/java/lang/Comparable.html<T>> https://developer.android.com/reference/java/util/Comparator.html#naturalOrder()()` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T> https://developer.android.com/reference/java/util/Comparator.html#nullsFirst(java.util.Comparator&lt;? super T&gt;)(https://developer.android.com/reference/java/util/Comparator.html<T> comparator)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T> https://developer.android.com/reference/java/util/Comparator.html#nullsLast(java.util.Comparator&lt;? super T&gt;)(https://developer.android.com/reference/java/util/Comparator.html<T> comparator)` `default static https://developer.android.com/reference/java/util/Comparator.html<T>` `<T extends https://developer.android.com/reference/java/lang/Comparable.html<T>> https://developer.android.com/reference/java/util/Comparator.html#reverseOrder()()` `default https://developer.android.com/reference/java/util/Comparator.html<T>` `https://developer.android.com/reference/java/util/Comparator.html#reversed()()` `default https://developer.android.com/reference/java/util/Comparator.html<T>` `https://developer.android.com/reference/java/util/Comparator.html#thenComparing(java.util.Comparator&lt;? super T&gt;)(https://developer.android.com/reference/java/util/Comparator.html<T> other)` `default https://developer.android.com/reference/java/util/Comparator.html<T>` `https://developer.android.com/reference/java/util/Comparator.html#thenComparingDouble(java.util.function.ToDoubleFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToDoubleFunction.html<T> keyExtractor)` `default https://developer.android.com/reference/java/util/Comparator.html<T>` `https://developer.android.com/reference/java/util/Comparator.html#thenComparingInt(java.util.function.ToIntFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToIntFunction.html<T> keyExtractor)` `default https://developer.android.com/reference/java/util/Comparator.html<T>` `https://developer.android.com/reference/java/util/Comparator.html#thenComparingLong(java.util.function.ToLongFunction&lt;? super T&gt;)(https://developer.android.com/reference/java/util/function/ToLongFunction.html<T> keyExtractor)`

## Public methods

### setInvalidationListener

```
abstract void setInvalidationListener(
    @Nullable RankingDataComparator.InvalidationListener invalidationListener
)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener`.