Vector<MenuItem> with TreeSet ?

I hope this is the rigth forum

I want to add to a vector the Objects in a TreeSet to made a menuItem

if was a hashmap like this it works

public Vector<MenuItem> getVehicles()

{

Vector<MenuItem> vector = new Vector<MenuItem>();

vector.addAll(hashMapWithObjects.values());

return vector;

}

and for the TreeSet?

Thanks!!!

[433 byte] By [tony_bravoa] at [2007-11-27 8:20:14]
# 1
Huh?
Hippolytea at 2007-7-12 20:08:31 > top of Java-index,Java Essentials,New To Java...
# 2

If you read the api for TreeSet, you'll see that it implements Iterable, Collection, and Set, all of which have methods that return the contents of the collection.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeSet.html

The values() method is specific to maps, so you'll need something a little different for a set.

hunter9000a at 2007-7-12 20:08:31 > top of Java-index,Java Essentials,New To Java...