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.
 
 
 
 
 
 
zanninso db990087bf
docs: adding subjects for quest 5 of the java piscine (#2062)
1 year ago
..
README.md docs: adding subjects for quest 5 of the java piscine (#2062) 1 year ago

README.md

ListContains

Instructions

Create a file ListContains.java.

Write a function containsValue that returns true if the list as parameter contains the element as parameter, false otherwise.

Expected Functions

import java.util.List;

public class ListContains {
    public static boolean containsValue(List<Integer> list, Integer value) {
        // your code here
    }
}

Usage

Here is a possible ExerciseRunner.java to test your function :

import java.util.List;

public class ExerciseRunner {

    public static void main(String[] args) {
        System.out.println(ListContains.containsValue(List.of(9, 13, 8, 23, 1, 0, 89), 8));
        System.out.println(ListContains.containsValue(List.of(9, 13, 8, 23, 1, 0, 89), 10));
    }
}

and its output :

$ javac *.java -d build
$ java -cp build ExerciseRunner
true
false
$

Notions

List