I am learning java. I am trying to use a composite design pattern. I am trying to use the following logic. (Do not laugh, I know that it is very simple :))
Item -> interface Folder -> class File -> class
In a folder class, can I create an arraylist element to store file information?
ArrayList<Item> info = ArrayList<Item>();
Or do I need to use a Folder Arraylist?
ArrayList<Folder> info = ArrayList<Folder>();
I do not know if the interface can store real data, since there is no function definition variable.
Thanks for the help to the beginner :)
source share