my dog learned polymorphism*
The moose likes Java in General and the fly likes Sorting keys automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sorting keys automatically" Watch "Sorting keys automatically" New topic
Author

Sorting keys automatically

thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Which collection interface does Sort the keys automatically ?
1.MAP
2.SET
3.TreeMap
4.SortedSet
Steve Lovelace
Ranch Hand

Joined: Sep 03, 2003
Posts: 125
  • MAP - you must mean Map: keys but no sorting
  • SET - you must mean Set: no keys and no sorting
  • TreeMap - keys and sorting, but this is not an interface - it is a concrete class
  • SortedSet: sorting but no keys

  • [ September 30, 2003: Message edited by: Steve Lovelace ]

    The Inner that is named is not the true Inner.
    Stan James
    (instanceof Sidekick)
    Ranch Hand

    Joined: Jan 29, 2003
    Posts: 8791
    See if this collections crib sheet helps. It's really brief, but should point you to some interesting places in the JDK docs.


    A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Sorting keys automatically
     
    Similar Threads
    WA #1.....word association
    Basic question on composite id.
    Creating Macros in Java
    default value in @oneToOne
    inserted primary key