[ 
https://issues.apache.org/jira/browse/COLLECTIONS-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13656357#comment-13656357
 ] 

Thomas Neidhart commented on COLLECTIONS-347:
---------------------------------------------

This could still be a useful addition, as it decorates another map to be 
bounded.
The patch has a few flaws that need to be corrected before committing:

 * use the BoundedMap interface instead of the self-defined LimitedSizeMap
 * modifications of the decorated map via iterator, entrySet or keySet are not 
reflected in the decorator, i.e. the queue containing the inserted keys is not 
updated accordingly
 * do not catch a RuntimeException in put, but instead reorder the instructions 
to make it fail-safe
 * the unit test should be plugged into the testing framework, e.g. inherit 
from AbstractIterableMapTest
                
> [contribution] LimitedSizeFifoMap
> ---------------------------------
>
>                 Key: COLLECTIONS-347
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-347
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Map
>            Reporter: Michael Thomas
>            Priority: Minor
>             Fix For: 4.x
>
>         Attachments: LimitedSizeFifoMap.patch, LimitedSizeFifoMap.patch
>
>
> The {{LimitedSizeFifoMap}} never exceeds a given element limit by deleting 
> old entries, whenever new ones are inserted. It may be of use for caches 
> holding memory-intense objects (it is for me, anyway).
> The patch contains:
> * the interface {{LimitedSizeMap}}
> * the fully documented implementation {{LimitedSizeFifoMap}}, which deletes 
> the oldest items first
> * the accompanying unit test
> If you find anything that needs improvement, please let me know.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to