Results 1 to 2 of 2

Thread: [java] map

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

    Default [java] map

    Hello,
    I need a structure like this:
    Qt Code:
    1. Hashtable<String, Vector<String>> _examples = new Hashtable<String, Vector<String>>();
    To copy to clipboard, switch view to plain text mode 

    but I need to insert "record" with duplicate key. HashTable don't permit this.
    Is there any other structure? Either a way to solve?

    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: [java] map

    there are several possibilities:
    i) there are MultiMap classes available for Java (-> google)
    ii) just use a list: i.e. instead of MutltiMap<Key,Value> use Hashtable<Key,IList<Value>>
    (that is not the same as now you can have empty lists as a key's value...;
    to be honest the second possibility is close to "roll your own MultiMap")

    HTH

Similar Threads

  1. [java] hashTable
    By mickey in forum General Programming
    Replies: 1
    Last Post: 28th July 2008, 23:35
  2. [java] write a simple server
    By mickey in forum General Programming
    Replies: 0
    Last Post: 22nd July 2008, 01:59
  3. [java] manipulate a string
    By mickey in forum General Programming
    Replies: 5
    Last Post: 10th July 2008, 21:22
  4. [Java] read and write a file
    By mickey in forum General Programming
    Replies: 3
    Last Post: 22nd June 2008, 11:43
  5. [java] access to member in composition
    By mickey in forum General Programming
    Replies: 2
    Last Post: 21st June 2008, 23:24

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.