[solved]Contents of array as Key/Value of HashMap

Discussion in 'Plugin Development' started by civ77, Apr 28, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    civ77

    I want to fill a hashmap with values from 1 array and keys from another, is this possible without a for() loop?
     
  2. Offline

    nickrak

    Technically, yes, you can do it with a while loop.
    I think the answer you are not wanting is, "no you can't do it without a loop".

    Maybe there's a better suited structure for the data than an array, what exactly are you storing?
     
  3. Offline

    civ77

    I have a file which the user can put things into, separated by commas, and then I use .split() to change the string into separate values in an array, however I don't really want it in an array, it's just the only way AFAIK to separate the words that the user has inputed.
     
  4. Why don't you use a for-loop? Why searching for maybe a complicated or a cpu expensive way when you already have a solution right in front of you waiting for being used?
     
  5. Offline

    civ77

    I know I was just hoping for a very simple solution so I guess I'll just have to use a for() loop.
     
Thread Status:
Not open for further replies.

Share This Page