Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
808 B
0
Indexable
Never
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;

public class _03_CustomMinFunction {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = Arrays.stream(scanner.nextLine().split("\\s+"))
                                      .map(Integer::parseInt)
                                      .toList();

        // Function: аргумент -> извършва се действие с този аргумент и връща резултат
        Function<List<Integer>, Integer> function = listOfNumbers -> Collections.min(listOfNumbers);

        Integer minValue = function.apply(numbers);

        System.out.println(minValue);
    }
}
Leave a Comment