Skip to content

Instantly share code, notes, and snippets.

@warriordog
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warriordog/05099369426dae9d80cc to your computer and use it in GitHub Desktop.
Save warriordog/05099369426dae9d80cc to your computer and use it in GitHub Desktop.
Todo List class
public class Todo {
private final Set<String> tasks = new HashSet<>();
public void addItem(String task) {
tasks.add(task);
}
public void deleteItem(String task) {
tasks.remove(task);
}
public void viewList() {
for (String str : tasks) {
System.out.println(str);
}
}
public static void main(String[] args) {
Todo todo = new Todo();
todo.addItem("Work on easy DP challenge");
todo.addItem("Work on intermediate DP challenge");
todo.viewList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment