I do not know for what reason this wont qualify as an answer.
When i check to code in Intelli J, enter e few numbers, the minimum is printed after hitting Enter on an empty field, yet here i not only get a NullPointerException but also it wont validate. Any thoughts ?
package com.codegym.task.task08.task0822;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/*
Minimum of N numbers3
*/
public class Solution {
public static void main(String[] args) throws Exception {
List<Integer> integerList = getIntegerList();
System.out.println(getMinimum(integerList));
}
public static int getMinimum(List<Integer> array){
int min = Integer.MAX_VALUE;
for(Integer ini : array){
min = ini < min ? ini : min;
}
return min;
}
public static List<Integer> getIntegerList() throws IOException {
ArrayList<Integer> lis = new ArrayList<Integer>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String ss = br.readLine();
if(ss.isEmpty()){
break;}
else{
int s = Integer.parseInt(ss);
lis.add(s);}
}
return lis;
}
}