commons-collections 学习笔记

Bag:
Defines a collection that counts the number of times an object appears in the collection. 

Suppose you have a Bag that contains {a, a, b, c}. Calling getCount(Object) on a would return 2, while calling uniqueSet() would return {a, b, c}. 

BidiMap:
Defines a map that allows bidirectional lookup between key and values. 

This extended Map represents a mapping where a key may lookup a value and a value may lookup a key with equal ease. This interface extends Map and so may be used anywhere a map is required. The interface provides an inverse map view, enabling full access to both directions of the BidiMap. 


LRUMap:
A Map implementation with a fixed maximum size which removes the least recently used entry if an entry is added when full. 

The least recently used algorithm works on the get and put operations only. Iteration of any kind, including setting the value by iteration, does not change the order. Queries such as containsKey and containsValue or access via views also do not change the order. 

The map implements OrderedMap and entries may be queried using the bidirectional OrderedMapIterator. The order returned is least recently used to most recently used. Iterators from map views can also be cast to OrderedIterator if required. 

All the available iterators can be reset back to the start by casting to ResettableIterator and calling reset(). 



你可能感兴趣的:(Collections)