Marko Pohajač created COLLECTIONS-786:
-----------------------------------------

             Summary: PassiveExpiringMap documentation - methods that involve 
accessing the entire map
                 Key: COLLECTIONS-786
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-786
             Project: Commons Collections
          Issue Type: Improvement
          Components: Map
    Affects Versions: 4.4
            Reporter: Marko Pohajač
             Fix For: 4.5
         Attachments: 
show_effect_of_containsKey_containsValue_on_expiration.diff

The documentation for PassiveExpiringMap says:
{quote}When invoking methods that involve accessing the entire map contents 
(i.e 
[{{containsKey(Object)}}|https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/map/PassiveExpiringMap.html#containsKey-java.lang.Object-],
 
[{{entrySet()}}|https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/map/PassiveExpiringMap.html#entrySet--],
 etc.) this decorator removes all expired entries prior to actually completing 
the invocation.
{quote}
 

Checked the code for containsKey and it doesn't seem to access the entire map, 
only the element of the key. If not sure about this, please check the attached 
patch as a proof.

Suggestion is to replace the example with containsValue(Object) or size() or 
something that does remove all expired entries prior to actually completing the 
invocation:
{quote}When invoking methods that involve accessing the entire map contents 
(i.e 
[{{containsValue(Object)}}|https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/map/PassiveExpiringMap.html#containsValue-java.lang.Object-],
 
[{{entrySet()}}|https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/map/PassiveExpiringMap.html#entrySet--],
 etc.) this decorator removes all expired entries prior to actually completing 
the invocation.
{quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to