java-exercism-exercises/karls-languages/HINTS.md

32 lines
1.6 KiB
Markdown

# Hints
## 1. Define a function to check if the language list is empty
* Try using the [`isEmpty()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#isEmpty()) method.
## 2. Define a function to add a language to the list
* Try using the [`add(E element)`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#add(E)) method.
* Reminder: methods that return `void` do not need any `return` statements.
## 3. Define a function to remove a language from the list
* Try using the [`remove(Object o)`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#remove(java.lang.Object)) method.
* Reminder: methods that return `void` do not need any `return` statements.
## 4. Define a function to return the first item in the list
* Try using the [`get(int index)`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#get(int)) method.
## 5. Define a function to return how many languages are in the list
* Try using the [`size()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#size()) method.
## 6. Define a function to determine if a language is in the list
* Try using the [`contains(Object o)`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#contains(java.lang.Object)) method.
## 7. Define a function to determine if the list is exciting
* Try using a [for-each loop](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html) through all of the elements, checking each one.
* Alternatively, try using the `containsLanguage` method from the previous step.