Results 1 to 2 of 2
  1. #1
    sandraW is offline Member
    Join Date
    Aug 2010
    Posts
    11
    Rep Power
    0

    Smile create TreeSet from HashSet and output the values to command window

    Need help on creating a TreeSet from the HashSet and using an iterator output the values of TreeSet to the command window. Strings in the HashSet are “Red”, “Yellow”, “Blue”, “Black”.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,725
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by sandraW View Post
    Need help on creating a TreeSet from the HashSet and using an iterator output the values of TreeSet to the command window. Strings in the HashSet are “Red”, “Yellow”, “Blue”, “Black”.
    There's a copy constructor for the TreeSet that takes a Collection as a parameter, in other words: you don't have to do anything ;-)

    kind regards,

    Jos

Similar Threads

  1. Compiler Output Window Issue
    By sweetpea123 in forum New To Java
    Replies: 2
    Last Post: 04-10-2010, 06:56 PM
  2. Scrollbar on graphics output window
    By ann123 in forum AWT / Swing
    Replies: 3
    Last Post: 06-27-2009, 09:47 PM
  3. how to get the values from command prompt
    By tej in forum New To Java
    Replies: 3
    Last Post: 05-02-2009, 09:32 AM
  4. Calling a JFrame window from a command line program.
    By new_2_java in forum New To Java
    Replies: 7
    Last Post: 11-09-2008, 04:40 AM
  5. Working with HashSet and TreeSet
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-15-2008, 08:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •