Store interface in array list java
- by agazerboy
Hi all,
I am learning java. I am trying to use composite design pattern. I am trying to use
following logic. ( Don't laugh I know it is very basic :) )
Item -> interface
Folder -> class
File -> class
In folder class, can I create an arraylist of Item to store files information?
ArrayList<Item> info = ArrayList<Item>();
Or should I use Folder Arraylist?
ArrayList<Folder> info = ArrayList<Folder>();
I don't know if interface can store real data as there is no variable just
function definitions.
Thanks for helping a newbie :)