Ad
Code
Diff
  • import java.util.Arrays;
    import java.util.stream.Collectors;
    import java.util.List;
    public class Kumite {
        public static String highAndLow(String numbers) {
    	List<Integer> list = Arrays.stream(numbers.split(" "))
    			.map(Integer::valueOf)
    			.collect(Collectors.toList());
    	return list.stream().max(Integer::compareTo).get() + " " + list.stream().min(Integer::compareTo).get();
        }
        }
    • import java.util.Arrays;
    • import java.util.stream.Collectors;
    • import java.util.List;
    • public class Kumite {
    • public static String highAndLow(String numbers) {
    • List<Integer> list = Arrays.stream(numbers.split(" "))
    • .map(Integer::valueOf)
    • .sorted()
    • .collect(Collectors.toList());
    • return list.get(list.size() - 1) + " " + list.get(0);
    • }
    • }
    • public static String highAndLow(String numbers) {
    • List<Integer> list = Arrays.stream(numbers.split(" "))
    • .map(Integer::valueOf)
    • .collect(Collectors.toList());
    • return list.stream().max(Integer::compareTo).get() + " " + list.stream().min(Integer::compareTo).get();
    • }
    • }