回答編集履歴

1

コードを修正

2017/12/19 22:29

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  import java.util.Arrays;
6
6
 
7
+ import java.util.Comparator;
8
+
7
9
  import java.util.List;
8
-
9
- import static java.util.Comparator.comparing;
10
10
 
11
11
 
12
12
 
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- System.out.println(list.stream().min(comparing((Integer x) -> Math.abs(x - target))).get());
23
+ System.out.println(list.stream().min(Comparator.comparing((Integer x) -> Math.abs(x - target))).get());
24
24
 
25
25
  }
26
26