Re: TreeSet and HashSet
- From: dagon@xxxxxxxxx (Mark Rafn)
- Date: Mon, 5 Feb 2007 18:20:54 -0800
Lew <conrad@xxxxxxxxxxxxxxxxxxxx> wrote:
I am mystified how it helps. What is the difference between
Object obj = o; and Object obj = enhancedSet.find( o );
The difference is that the second will return the "canonical" instance of o,
where the first leaves you with multiple copies.
In the rather specialized case where you have many or large objects and you'd
rather keep one instance of each than many, and you for some reason don't want
to hide it all in a factory or manager, this can make it easy.
In every case I can think of, it's pretty easy to make a factory or FooSet
that's specific to the data and hides the implementation such that nobody
cares whether the Set interface has this method or the factory just keeps a
HashMap.
--
Mark Rafn dagon@xxxxxxxxx <http://www.dagon.net/>
.
- Follow-Ups:
- Re: TreeSet and HashSet
- From: Esmond Pitt
- Re: TreeSet and HashSet
- References:
- TreeSet and HashSet
- From: Marcin
- Re: TreeSet and HashSet
- From: Chris Uppal
- Re: TreeSet and HashSet
- From: Lew
- TreeSet and HashSet
- Prev by Date: Re: Root Object == OO !?! [Was: Re: My strange service with an error]
- Next by Date: Re: How do you use as an array as an argument
- Previous by thread: Re: TreeSet and HashSet
- Next by thread: Re: TreeSet and HashSet
- Index(es):
Relevant Pages
|