Interface Lookback<K extends Comparable<K>>
- Type Parameters:
K- the key type.
public interface Lookback<K extends Comparable<K>>
Defines the strategy for providing the next key for the client to search for.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a key to the lookback tracking.booleanDetermines if the key is in the lookback.get()Gets the key to query for.static <T extends Comparable<T>>
Lookback<T>ofSize(int size) Creates a Lookback of the specified size.resize(int size) Resize the lookback.intsize()Gets the number of keys this Lookback can store.
-
Method Details
-
ofSize
Creates a Lookback of the specified size.- Type Parameters:
T- the key type.- Parameters:
size- the size of the lookback.- Returns:
- a lookback of the specified size;
-
add
Adds a key to the lookback tracking.- Parameters:
key- the key to add.
-
get
K get()Gets the key to query for.- Returns:
- the key to query for.
-
contains
Determines if the key is in the lookback.- Parameters:
key- the key to search for.- Returns:
- true if this lookback holds the key.
-
size
int size()Gets the number of keys this Lookback can store.- Returns:
- the number of keys this Lookback can store.
-
resize
Resize the lookback. May resize this lookback or create new one. The resulting lookback will contain as much of the latest data from this lookback as possible in the new configuration.- Parameters:
size- the desired size of the lookback. Ifsize < 0then 0 is used.- Returns:
- a
Lookbackinstance of the desired size.
-