Hello. Is this a good way to loop over a hashmap of this type. Code (Text): public static HashMap<String, List<RealmUpgrade>> realmUpgrades = new HashMap<>(); public static void UpgradeBuilder() { if (runUpgrades) { realmUpgrades.values().forEach((player) -> { player.forEach((realmUpgrades) -> { if (realmUpgrades.isCancel()) { player.remove(realmUpgrades); } realmUpgrades.PlaceBlock(); }); }); } Bukkit.getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() { @Override public void run() { UpgradeBuilder(); } }, upgradeDelay); }
Can you not remove them when using .forEach ? i know you can not when using for() EDIT: Nope you can not i was told you can. Okay time for a change !