deyanmalinov

03. Custom Min Function

Apr 22nd, 2020
369
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DPM;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5. import java.util.function.Function;
  6.  
  7. public class Main {
  8.     public static void main(String[] args) {
  9.         Scanner scan = new Scanner(System.in);
  10.         int[] nums = Arrays.stream(scan.nextLine().split("\\s+"))
  11.                 .mapToInt(Integer::parseInt)
  12.                 .toArray();
  13.  
  14.         Function<int[], Integer> min = arr ->{
  15.             int minnum = Arrays.stream(arr).min().getAsInt();
  16.             return minnum;
  17.         };
  18.         System.out.println(min.apply(nums));
  19.     }
  20. }
RAW Paste Data