T - public class WeightedEvictableList<T> extends Object
maxSize, the half of
 the entries with less weight are evicted.
 When a specified number of votes are cast the list is re-organized
 to bring the items with the most votes in front. Also, every time
 maxSize is reached, the list is reorganized.
 The list is not thread-safe.| Modifier and Type | Class and Description | 
|---|---|
| static class  | WeightedEvictableList.WeightedItem<T>A node that contains an item and its weight | 
| Constructor and Description | 
|---|
| WeightedEvictableList(int maxSize,
                     int maxVotesBeforeReorganization) | 
| Modifier and Type | Method and Description | 
|---|---|
| WeightedEvictableList.WeightedItem<T> | addOrVote(T item)Adds a new item to the list or votes for the given item if it
 already exists. | 
| List<WeightedEvictableList.WeightedItem<T>> | getList() | 
| WeightedEvictableList.WeightedItem<T> | getWeightedItem(int index) | 
| int | size() | 
| void | voteFor(WeightedEvictableList.WeightedItem<T> weightedItem)Casts a vote for given list node. | 
public WeightedEvictableList(int maxSize,
                             int maxVotesBeforeReorganization)
maxSize - Maximum number of items this list
                                      can keep.maxVotesBeforeReorganization - How many voteFor(WeightedItem)
                                      operations are allowed, before items
                                      are re-ordered based on on their
                                      weights.public List<WeightedEvictableList.WeightedItem<T>> getList()
public void voteFor(WeightedEvictableList.WeightedItem<T> weightedItem)
weightedItem - public WeightedEvictableList.WeightedItem<T> addOrVote(T item)
maxSize is reached, half of the
 list is removed.
 When half of the list is removed, the weights of all the items
 are reset. The newly added item gets a vote if applicable.item - public WeightedEvictableList.WeightedItem<T> getWeightedItem(int index)
public int size()
Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.