SHARE
TWEET

Untitled

a guest May 12th, 2016 348 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. import java.util.function.Function;
  4.  
  5. public class MinFunc {
  6.     public static void main(String[] args) {
  7.         Scanner sc = new Scanner(System.in);
  8.         int [] intArray = Arrays.stream(sc.nextLine().split("\\s+")).mapToInt(Integer::parseInt).toArray();
  9.         System.out.println(findMinElement.apply(intArray));
  10.     }
  11.  
  12.   private static Function<int[],Integer> findMinElement = new Function<int[],Integer>(){
  13.         public Integer apply(int [] array){
  14.             int minimum = array[0];
  15.             for(Integer num : array){
  16.                 if(minimum>num){
  17.                     minimum=num;
  18.                 }
  19.             }
  20.             return minimum;
  21.         }
  22.     };
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top