hey, i am trying to make a random drops plugin/class, and it seems that it doesnt work, eclipse shows up an error, and idk what it exactly means, or whats wrong. maybe someone can help me: The class part: Code: private final ArrayList<Material> BLOCKS; private final ArrayList<Material> ITEM_DROPS; private HashMap<Material, Material> drops = new HashMap<>(); public RandomDrops() { this.BLOCKS = (ArrayList<Material>) Arrays.<Material>stream(Material.values()).filter(mat -> mat.isBlock()) .collect(Collectors.toList()); this.ITEM_DROPS = (ArrayList<Material>) Arrays.<Material>stream(Material.values()) .filter(mat -> mat.isItem() //<--HERE || mat == Material.BEDROCK).collect(Collectors.toList()); the error i get is at "mat.isitem()" at the last line, its showing: The method isItem() is undefined for the type Material
IDE's have problems showing the exact problems when you use lamdas. I'm pretty sure that's not how you start a stream. Instead of using <> to define a type, just map the stream to Material. Also when you already know that your collection should be an ArrayList, you can use #toCollection(ArrayList::new)