public final class FrequencyTrackingRingBuffer extends Object implements Accountable
NULL_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, wait
getChildResources
public FrequencyTrackingRingBuffer(int maxSize, int sentinel)
maxSize
items.
This buffer will initially contain maxSize
times the
sentinel
value.public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public void add(int i)
public int frequency(int key)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.