info@meritcampus.com    +91-85006-22255
...

Write a program to find given number is equals to any one of the numbers.

Input (Double value, List of double values) Output
18.23
[12.0, 23.45, 16.98, 18.23, 23.56]
true
-23.45
[10.22, 0.045, 0.98, 0.07, -23.45, -19.34]
true
12.98
[-12.0, -23.45, -16.98, -9.07, -23.56]
false
56.78
[] {EMPTY LIST}
false
null
[-0.0, -0.045, -0.98, -0.07, -0.56]
false

``` import java.util.*; class EqualsAnyOfValues {     public static void main(String s[])    {        List<Double> list = new ArrayList<Double>();        list.add(12.0);        list.add(23.45);        list.add(16.98);        list.add(18.23);        list.add(23.56);        Double value = 18.23;        boolean result = equalsAny(value, list);        System.out.println("The given value "+value+" is equals to any of the values "+list+" should be "+result);    }         public static boolean equalsAny(Double value, List<Double> list)         {             boolean result = false; ```
```             return result;         } } ```

Topic: Java ArrayList

0
Wrong
Score more than 2 points