[ 
https://issues.apache.org/jira/browse/COLLECTIONS-786?focusedWorklogId=600388&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-600388
 ]

ASF GitHub Bot logged work on COLLECTIONS-786:
----------------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/May/21 14:27
            Start Date: 21/May/21 14:27
    Worklog Time Spent: 10m 
      Work Description: vandrewskis opened a new pull request #237:
URL: https://github.com/apache/commons-collections/pull/237


   `containsKey` does not access entire map, while
   `containsValue` does


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 600388)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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č
>            Priority: Minor
>         Attachments: fix_doc.diff, 
> show_effect_of_containsKey_containsValue_on_expiration.diff
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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 [^show_effect_of_containsKey_containsValue_on_expiration.diff] 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}
> Potential fix patch: [^fix_doc.diff]



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

Reply via email to