-
-
Save warriordog/05099369426dae9d80cc to your computer and use it in GitHub Desktop.
Todo List class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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