jhalterman / expiringmap

A high performance thread-safe map that expires entries
Apache License 2.0
1.01k stars 142 forks source link

Java documentation gives wrong time complexity #25

Closed diedirk closed 8 years ago

diedirk commented 8 years ago

This is my first time logging an issue. Please bare with me if I'm not following the correct process.

The Java documentation for Expiring map says: "put/remove operations are constant O(n). When variable expiration is enabled, put/remove operations impose an O(log n) cost."

Believe that should be O(1) instead of O(log n).

jhalterman commented 8 years ago

Thanks for pointing this out. It was previously fixed in the README but not in the javadocs. Should be O(1) unless using variable expiration, then it's O(log n) (since TreeSet is used internally in that case).