parent
08d7475257
commit
30ea1ec59c
@ -0,0 +1,31 @@
|
||||
package data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//Singleton pattern from https://www.tutorialspoint.com/java/java_using_singleton.htm
|
||||
public class ListOfWatchList {
|
||||
private static ListOfWatchList lowl = new ListOfWatchList();
|
||||
private ArrayList<WatchList> wlists;
|
||||
|
||||
private ListOfWatchList() {
|
||||
wlists = new ArrayList<WatchList>();
|
||||
}
|
||||
|
||||
public static ListOfWatchList getList() {
|
||||
return lowl;
|
||||
}
|
||||
|
||||
public void addWatchList(WatchList wlist) {
|
||||
if (!(wlists.contains(wlist))) {
|
||||
wlists.add(wlist);
|
||||
}
|
||||
}
|
||||
|
||||
public void delWatchList(WatchList wlist) {
|
||||
wlists.remove(wlist);
|
||||
}
|
||||
|
||||
public WatchList getWatchList(int index) {
|
||||
return (WatchList) wlists.get(index);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue