[rfc][icedtea-web] TimedHashMap

Andrew Azores aazores at redhat.com
Fri May 9 18:15:01 UTC 2014


On 05/09/2014 12:38 PM, Omair Majid wrote:
> * 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.

Sure, that works too.

>
>> 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
>

I think I actually would like to fix it, it seems like a nice little 
amusement. Maybe more uses will be found for it some time too.

Thanks,

-- 
Andrew A



More information about the distro-pkg-dev mailing list