Solved loading hashmap by config

Discussion in 'Spigot Plugin Development' started by MadMaxCookie, Jun 18, 2016.

  1. Code (Java):
    HashMap<String, Double> hashmap = new HashMap<>();
    I saved hashmap onDisable by doing this

    Code (Java):
    for(String name  : hashmap.keySet()) {

       config.set(name, hashmap.get(name));

    now how to load in onEnable() ???
     
  2. Literally do the reverse. Iterate over the config entries, and put them back into the Map. Also, you could iterate over the entrySet for better performance (you don't need to use Map#get when you do, as you already have Entry#getValue())
     
  3. yeah no idea on reverse mode help please?
     
  4. I literally explained it right afterwards
     
  5. sets to hashmap?
     
  6. @MadMaxCookie as for 'how to iterate over the config entries', check the documentation of Configuration ;)
     
  7. sorry got it I was thinking how last night