Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Overall, it is a bad idea to have static variables like this.
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
So this would be better:
private static final List<Album> albumList = new ArrayList<Album>();
However, ask yourself these two questions: Does the order of the albums matter? Should it be possible to have two equal objects in the list? If the answer to both these questions is No, then it would be better of as Set<Album> albums = new HashSet<Album>();
Additionally, you can see a previous answer of mine previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Overall, it is a bad idea to have static variables like this.
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
So this would be better:
private static final List<Album> albumList = new ArrayList<Album>();
However, ask yourself these two questions: Does the order of the albums matter? Should it be possible to have two equal objects in the list? If the answer to both these questions is No, then it would be better of as Set<Album> albums = new HashSet<Album>();
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Overall, it is a bad idea to have static variables like this.
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
So this would be better:
private static final List<Album> albumList = new ArrayList<Album>();
However, ask yourself these two questions: Does the order of the albums matter? Should it be possible to have two equal objects in the list? If the answer to both these questions is No, then it would be better of as Set<Album> albums = new HashSet<Album>();
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Overall, it is a bad idea to have static variables like this.
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
So this would be better:
private static final List<Album> albumList = new ArrayList<Album>();
However, ask yourself these two questions: Does the order of the albums matter? Should it be possible to have two equal objects in the list? If the answer to both these questions is No, then it would be better of as Set<Album> albums = new HashSet<Album>();
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Overall, it is a bad idea to have static variables like this.
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
So this would be better:
private static final List<Album> albumList = new ArrayList<Album>();
However, ask yourself these two questions: Does the order of the albums matter? Should it be possible to have two equal objects in the list? If the answer to both these questions is No, then it would be better of as Set<Album> albums = new HashSet<Album>();
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.
Yes, this is a Singleton class. Or actually, technically this is not even a singleton as it doesn't appear to be instantiated at all.
What makes it similar to a singleton class though is that there is only, and can be only one variable of these:
private static ArrayList<Song> songList;
private static ArrayList<Album> albumList;
Some few additional comments:
- Make your variables
final
- Declare as
List
and instantiate asArrayList
Additionally, you can see a previous answer of mine related to the Singleton pattern in Android, in this case I would recommend janos' approach though.