Results 1 to 2 of 2
  1. #1
    chkontog is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default Query about data structure


    i have a HashMap<String, String> but when i put elements in hashmap it deletes duplicate keys.
    So, I would like to ask, which data structure to use, to combine keys and elements, without delete duplicate keys?


  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Rep Power

    Default Re: Query about data structure

    So, the expected behavior you desire is to have 1 key return multiple objects? You can still do this with a map, but you will need to store a collection for the value instead of a string, and you will need to check and see if it exists before you insert.

Similar Threads

  1. Which data structure to use?
    By malaguena in forum New To Java
    Replies: 4
    Last Post: 04-05-2011, 05:41 PM
  2. Which data structure to choose ?
    By lumpy in forum New To Java
    Replies: 2
    Last Post: 02-20-2010, 05:43 AM
  3. data structure and data base??
    By ahmed13 in forum Advanced Java
    Replies: 8
    Last Post: 03-27-2009, 06:48 AM
  4. data file structure
    By Nicholas Jordan in forum Advanced Java
    Replies: 2
    Last Post: 01-07-2009, 05:16 AM
  5. Queue data structure
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 09:35 PM

Posting Permissions

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