implements set and map

I

Ike

Is anyone aware of a Collections Object that implements both the Set and Map
Interfaces concurrently? Is it possible to even create one?

Thanks, Ike
 
T

Thomas Weidenfeller

Ike said:
Is anyone aware of a Collections Object that implements both the Set and Map
Interfaces concurrently? Is it possible to even create one?

Why do you want to? Map.keySet() gives you a view on the map's keys as a
Set. Map.entrySet() gives you a view on the entries in a map as a Set.

/Thomas
 
G

Gerbrand van Dieijen

Thomas Weidenfeller schreef:
Why do you want to? Map.keySet() gives you a view on the map's keys as a
Set. Map.entrySet() gives you a view on the entries in a map as a Set.

/Thomas
Apache Jakarta Commons also include a Map where the values (right side)
can be used as keys too.
I think that is as 'concurrently' the Map/Set implementation can be, the
Map is merely an extension of Set.
 
C

Christian Kaufhold

Ike said:
Is anyone aware of a Collections Object that implements both the Set and Map
Interfaces concurrently? Is it possible to even create one?

No, because remove(Object) (1.5?), equals, and hashCode clash.


Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top