Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marcus Ikdal #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bin/main/com/booleanuk/core/Exercise.class
Binary file not shown.
Binary file added bin/main/com/booleanuk/extension/Extension.class
Binary file not shown.
Binary file added bin/main/com/booleanuk/helpers/ExerciseBase.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest$1.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest$2.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest$3.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest$4.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest$5.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/core/ExerciseTest.class
Binary file not shown.
Binary file added bin/test/com/booleanuk/extension/ExtensionTest.class
Binary file not shown.
22 changes: 22 additions & 0 deletions src/main/java/com/booleanuk/core/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public ArrayList<Integer> getFavouriteNumbers() {
TODO: 1. Create a method named getSecondNumber that returns a whole number. It must return the
second number contained in the list that is returned from getFavouriteNumbers
*/
public int getSecondNumber() {
return getFavouriteNumbers().get(1);
}



Expand All @@ -55,6 +58,10 @@ public ArrayList<Integer> getFavouriteNumbers() {
Use the ArrayList's replaceAll method to iterate through the ArrayList and replace each value with its double
https://www.programiz.com/java-programming/library/arraylist/replaceall
*/
public ArrayList<Integer> multiply(ArrayList<Integer> nums, int n) {
nums.replaceAll(num -> num * n);
return nums;
}



Expand All @@ -63,6 +70,9 @@ public ArrayList<Integer> getFavouriteNumbers() {
- A list of strings
The method must return a boolean that indicates whether the provided list is empty or not
*/
public boolean isEmpty(ArrayList<String> strings) {
return strings.isEmpty();
}



Expand All @@ -72,6 +82,10 @@ public ArrayList<Integer> getFavouriteNumbers() {
- A string
The method must add the second parameter into the list provided and then return the list
*/
public ArrayList<String> addIngredient(ArrayList<String> strings, String s) {
strings.add(s);
return strings;
}



Expand All @@ -81,6 +95,10 @@ public ArrayList<Integer> getFavouriteNumbers() {
- A string
The method must remove the second parameter from the list and then return the list
*/
public ArrayList<String> removeIngredient(ArrayList<String> strings, String s) {
strings.remove(s);
return strings;
}



Expand All @@ -91,6 +109,10 @@ public ArrayList<Integer> getFavouriteNumbers() {
The method must return a boolean that indicates whether the second parameter exists in the provided list
*/

public boolean containsIngredient(ArrayList<String> strings, String s) {
return strings.contains(s);
}



}
Loading