public final class FrequencyTrackingRingBuffer extends Object implements Accountable
| Constructor and Description |
|---|
FrequencyTrackingRingBuffer(int maxSize,
int sentinel)
Create a new ring buffer that will contain at most
maxSize items. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int i)
Add a new item to this ring buffer, potentially removing the oldest
entry from this buffer if it is already full.
|
int |
frequency(int key)
Returns the frequency of the provided key in the ring buffer.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetChildResourcespublic FrequencyTrackingRingBuffer(int maxSize,
int sentinel)
maxSize items.
This buffer will initially contain maxSize times the
sentinel value.public long ramBytesUsed()
AccountableramBytesUsed in interface Accountablepublic void add(int i)
public int frequency(int key)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.