So I'm trying to cache items from the bank and save them for when the bank is closed, I've tried making a HashMap<String, Integer> for it, but what I've been doing isn't working and I'd like some assistance with how I can make it work.
HashMap<String, Integer> bankHash = new HashMap<String, Integer>();
//adding values to my bankHash
Integer amtOfItemHere = (int)Values.getBank().getAmount("itemNameHere");
bankHash.put("itemNameHere", amtOfItemHere);
//method to grab the hashed item
public int hashedItemHere() {
return bankHash.get("itemNameHere"); //trying to return
}
I've tried nullchecking them before calling the method, but it won't collect the data that I'm trying to collect. It's likely because the Int I'm trying to use is only usable while the bank is open, but my issue is: how can I do this properly so I can cache items from the bank?
What I'm trying to use this for is to calculate the number of items I need to buy from the GE
// quantity = default - hashedNum;