HashMaps or ArrayLists?

Discussion in 'Plugin Development' started by diamondcodes, Sep 15, 2014.

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

    diamondcodes

    So I have been wondering, Which is better to use for storing player data such as, Bans & Mutes, ArrayLists or HashMaps? From what I understand ArrayLists reset on reload/Restart? And HashMaps dont? (Or how would I save a players name to a config when I ban them to store it that way?)
     
  2. Offline

    fireblast709

    diamondcodes everything you don't save/load will be reset on reload/restart. I should store both in a Map, to facilitate temp bans and temp mutes.

    (Basically, a Map<UUID, Long> with the Player's UUID as the key, and s timestamp as value - where -1 is permanent)
     
  3. Offline

    rbrick

    It depends on your use. They have different purposes(Well ultimately both are used to store information, but one is a basic list the other is a Key, Value system)
     
  4. Offline

    diamondcodes

    fireblast709 So how would I save a ArrayList onDisable and onEnable?
     
  5. Offline

    Skionz

    diamondcodes onDisable loop through the ArrayList and put it in the config
     
Thread Status:
Not open for further replies.

Share This Page