commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: [collections] [PATCH] Adding singleton List, Set & Map
Date Thu, 05 Sep 2002 12:59:32 GMT
Michael A. Smith wrote:
> Christopher Lenz wrote:
> 
>> Hi all,
>>
>> attached is a patch that introduces three new adapters to collections. 
>> These are implementations of the interfaces Set, List and Map that 
>> wrap around a single object (or a single key/value pair for the Map), 
>> similar to how SingletonIterator and SingletonListIterator work.
> 
> [snip]
> 
>> Thoughts?
> 
> 
> Singleton for a set has existed in the JDK since 1.2:
> java.util.Collections#singleton(Object)
> 
> Singletons for List and Set have existed in the JDK since 1.3:
> java.util.Collections#singletonList(Object)
> java.util.Collections#singletonMap(Object,Object)

<blush>
Whoa, I've completely missed those! I can't believe this :P

> In the past we've tried avoiding duplicating functionality provided in 
> the JDK because the collections is supposed to "fill the holes" that Sun 
> left, not duplicate the stuff they had already implemented.  Since two 
> of these only exist in 1.3, and we try to target 1.2, maybe we should 
> revisit the issue?

It might be a good idea, a lot of projects are still targetting 1.2.

(note me not closing the blush tag ;-))

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message