# SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction

# SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction

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/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.java+class:androidx.media3.exoplayer.upstream.experimental.SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction "View this page in Java")

<br />

```
interface SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction
```

<br />

*** ** * ** ***

An interface to decide if samples need to be evicted from the estimator.

## Summary

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [shouldEvictSample](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction#shouldEvictSample(java.util.Deque<androidx.media3.exoplayer.upstream.experimental.SlidingWeightedAverageBandwidthStatistic.Sample>))`(` ` samples: `[Deque](https://developer.android.com/reference/java/util/Deque.html)`<`[SlidingWeightedAverageBandwidthStatistic.Sample](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.Sample)`!>!` `)` Whether the sample at the front of the queue needs to be evicted. |

## Public functions

### shouldEvictSample

```
fun shouldEvictSample(
    samples: Deque<SlidingWeightedAverageBandwidthStatistic.Sample!>!
): Boolean
```

Whether the sample at the front of the queue needs to be evicted. Called before adding a next sample.  

|                                                                                                                                        Parameters                                                                                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `samples: `[Deque](https://developer.android.com/reference/java/util/Deque.html)`<`[SlidingWeightedAverageBandwidthStatistic.Sample](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.Sample)`!>!` | A queue of samples, ordered by[timeAddedMs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.Sample#timeAddedMs()). The oldest sample is at front of the queue. The queue must not be modified. |