# 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
interface RankingDataComparator<T> : Comparator<T!>
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/preload/DefaultPreloadManager.SimpleRankingDataComparator` | A `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/exoplayer/source/preload/DefaultPreloadManager.SimpleRankingDataComparator#setCurrentPlayingIndex(int)`. |

*** ** * ** ***

A comparator of ranking data.

## Summary

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

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/preload/RankingDataComparator#setInvalidationListener(androidx.media3.exoplayer.source.preload.RankingDataComparator.InvalidationListener)( invalidationListener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener? )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/preload/RankingDataComparator.InvalidationListener`. |

### Inherited functions

From [java.util.Comparator](https://developer.android.com/reference/java/util/Comparator.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/java/util/Comparator.html#compare(T, T)(p: T!, p1: T!)` `java-static https://developer.android.com/reference/java/util/Comparator.html<T!>!` `<T, U : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparable/index.html<U!>?> https://developer.android.com/reference/java/util/Comparator.html#comparing(java.util.function.Function&lt;? super T,? extends U&gt;)(keyExtractor: https://developer.android.com/reference/java/util/function/Function.html<T!, U!>!)` `java-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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToDoubleFunction.html<T!>!)` `java-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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToIntFunction.html<T!>!)` `java-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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToLongFunction.html<T!>!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/java/util/Comparator.html#equals(java.lang.Object)(p: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` `java-static https://developer.android.com/reference/java/util/Comparator.html<T!>!` `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparable/index.html<T!>?> https://developer.android.com/reference/java/util/Comparator.html#naturalOrder()()` `java-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;)(comparator: https://developer.android.com/reference/java/util/Comparator.html<T!>!)` `java-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;)(comparator: https://developer.android.com/reference/java/util/Comparator.html<T!>!)` `java-static https://developer.android.com/reference/java/util/Comparator.html<T!>!` `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparable/index.html<T!>?> https://developer.android.com/reference/java/util/Comparator.html#reverseOrder()()` `https://developer.android.com/reference/java/util/Comparator.html<T!>!` `https://developer.android.com/reference/java/util/Comparator.html#reversed()()` `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;)(other: https://developer.android.com/reference/java/util/Comparator.html<T!>!)` `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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToDoubleFunction.html<T!>!)` `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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToIntFunction.html<T!>!)` `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;)(keyExtractor: https://developer.android.com/reference/java/util/function/ToLongFunction.html<T!>!)`

## Public functions

### setInvalidationListener

```
fun setInvalidationListener(
    invalidationListener: RankingDataComparator.InvalidationListener?
): Unit
```

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