Results 1 to 3 of 3

Thread: sort a vector in Java

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default sort a vector in Java

    Hello,

    does exist in Java a structure like a Vector<String> (or similar) that do two things:
    - is automatically sorted when an element is added (I need by string)
    - avoid to insert duplicates

    thanks,
    Regards

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: sort a vector in Java

    Vector and automatically sorted are somewhat contradictive goals.

    Have a look at Set and HashSet.

    HTH

  3. #3
    Join Date
    Jul 2009
    Posts
    13
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sort a vector in Java

    TreeSet is sorted and does not allow duplicates.

Similar Threads

  1. qtableview sort question?
    By yunpeng880 in forum Qt Programming
    Replies: 2
    Last Post: 3rd March 2009, 09:28
  2. QTreeWidget (Row Check, Custom Sort)
    By AaronMK in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2008, 15:55
  3. How to sort the treeWidget item according to size and date
    By santosh.kumar in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2007, 10:32
  4. How to sort a QComboBox in Qt4
    By guenthk in forum Qt Programming
    Replies: 7
    Last Post: 25th September 2006, 18:35
  5. Embedding Java in Qt
    By learnerplts in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2006, 15:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.