You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
749 B
32 lines
749 B
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);
|
|
}
|
|
}
|