[rfc][icedtea-web] TimedHashMap

Omair Majid omajid at redhat.com
Fri May 9 16:38:19 UTC 2014


* Andrew Azores <aazores at redhat.com> [2014-05-09 12:04]:
> Hi,
> 
> I've attached some quick tests for TimedHashMap to ensure that the entries
> actually expire as they are claimed to.

Looks good to me. Maybe you can make the test a little faster by making
the timeout 0 instead of 0.25 seconds.

> Would it be worth expanding on this class to make it actually implement the
> Map interface, keep its composed Maps private, and refactor it to only be
> composed of one map rather than two? It's obviously not needed right now,
> but I can't help but feel that this is a pretty poor implementation of a
> "HashMap" that it claims to be.

Depending on what it's used for, maybe a name change to clarify that
this is a timed cache (with O(1) lookup but not a HashTable and not a
HashMap) might be easier.

But if you want to fix it to be a proper Map implementation, I dont have
any real concerns. Just be prepared that things might break if more
default methods are added to Map in Java 9.

Thanks,
Omair

-- 
PGP Key: 66484681 (http://pgp.mit.edu/)
Fingerprint = F072 555B 0A17 3957 4E95  0056 F286 F14F 6648 4681


More information about the distro-pkg-dev mailing list