I have Singleton class like this:
public class Singleton
private static Singleton instance;
private ArrayList<Release> releases;
private ArrayList<Place> places;
ArrayList<ArrayList<Object>> list = new ArrayList<ArrayList<Object>>(2);
private Singleton() {
releases = new ArrayList<Release>();
places = new ArrayList<Place>();
list.add(release); //error, required AL<Object>, provided AL<Release>
list.add(places); //same
}
public static Singleton getInstance(){
/* Singleton code */
}
I thought that it is possible because, every Class extends Object class. My intention is to read from files where ALs are saved as object a then these ALs have in collection of one AL, where al.get(PLACES_INDEX) would return places and so on. It is a good approach or am I missing something?
Later on I would like to have some unified method, which would be something like:
public ArrayList<T> getArrayList() {
/*return places or releases based on <T>*/
}
I don't know if it's even possible since this class is Singleton.