stevenl4 0 Posted January 11, 2017 Using Java8 say I wanted to deposit everything except a Bronze pickaxe, I'd use getBank().depositAllExcept(items -> items.getName().equals("Bronze pickaxe")); What do I do if I want to deposit everything except a Bronze pickaxe, 500 coins and Varrock teleport tab using similar code?
Pandemic 2853 Posted January 11, 2017 Using Java8 say I wanted to deposit everything except a Bronze pickaxe, I'd use getBank().depositAllExcept(items -> items.getName().equals("Bronze pickaxe")); What do I do if I want to deposit everything except a Bronze pickaxe, 500 coins and Varrock teleport tab using similar code? If it's just a couple things, you can do: getBank().depositAllExcept(i -> i.getName().equals("Bronze pickaxe") || i.getName().equals("Coins")); Otherwise you can have a list of names, and do: getBank().depositAllExcept(i -> list.contains(i.getName()));
stevenl4 0 Author Posted January 11, 2017 If it's just a couple things, you can do: getBank().depositAllExcept(i -> i.getName().equals("Bronze pickaxe") || i.getName().equals("Coins")); Otherwise you can have a list of names, and do: getBank().depositAllExcept(i -> list.contains(i.getName())); I think the second one is what I'm looking for, how do I create a list of items currently in my inventory at the beginning of the script? Thanks
Neffarion 486 Posted January 11, 2017 I think the second one is what I'm looking for, how do I create a list of items currently in my inventory at the beginning of the script? Thanks ArrayList<Item> invItems = new ArrayList<>(getInventory().all()); That will work but you need to call that when you need to check. If you just call at the beginning of the script it will only get the items that exist in the inventory at the beginning of the script
Eclipseop 194 Posted January 12, 2017 ArrayList<Item> invItems = new ArrayList<>(getInventory().all()); That will work but you need to call that when you need to check. If you just call at the beginning of the script it will only get the items that exist in the inventory at the beginning of the script Why construct it as an arraylist when #all returns a list? unless there is some reason why you need an arraylist over a list xd
Neffarion 486 Posted January 12, 2017 Why construct it as an arraylist when #all returns a list? unless there is some reason why you need an arraylist over a list xd ArrayList rules! Just got used to do it tbh
Recommended Posts
Archived
This topic is now archived and is closed to further replies.