eclipse error

Discussion in 'Plugin Development' started by VNGC, Apr 13, 2020.

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


    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:

        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())
            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
  2. Offline


    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)
Thread Status:
Not open for further replies.

Share This Page