Store interface in array list java
        Posted  
        
            by agazerboy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by agazerboy
        
        
        
        Published on 2010-03-13T23:58:10Z
        Indexed on 
            2010/03/14
            0:05 UTC
        
        
        Read the original article
        Hit count: 296
        
java
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 :)
© Stack Overflow or respective owner