回答編集履歴

3

ソースの修正

2017/07/19 04:13

投稿

mr-hisa-child
mr-hisa-child

スコア294

test CHANGED
@@ -42,9 +42,15 @@
42
42
 
43
43
  public static String getMessage(String a,String b){
44
44
 
45
- Optional<Judge> judge = Stream.of(Judge.values()).filter(j -> j.a.equals(a) && j.b.equals(b)).findAny();
45
+ return Stream.of(Judge.values())
46
46
 
47
+ .filter(j -> j.a.equals(a) && j.b.equals(b))
48
+
49
+ .findAny()
50
+
47
- return judge.orElse(UNKNOWN).message;
51
+ .orElse(UNKNOWN)
52
+
53
+ .message;
48
54
 
49
55
  }
50
56
 

2

コメントの指摘対応

2017/07/19 04:13

投稿

mr-hisa-child
mr-hisa-child

スコア294

test CHANGED
@@ -14,7 +14,9 @@
14
14
 
15
15
  SLIGHTLY_HIGH("○","×","やや高い"),
16
16
 
17
- HIGH("○","○","高い");
17
+ HIGH("○","○","高い"),
18
+
19
+ UNKNOWN("-","-","");
18
20
 
19
21
 
20
22
 
@@ -42,9 +44,7 @@
42
44
 
43
45
  Optional<Judge> judge = Stream.of(Judge.values()).filter(j -> j.a.equals(a) && j.b.equals(b)).findAny();
44
46
 
45
- return judge.isPresent() ? judge.get().message : "";
47
+ return judge.orElse(UNKNOWN).message;
46
-
47
- }
48
48
 
49
49
  }
50
50
 

1

ソースの修正

2017/07/19 04:11

投稿

mr-hisa-child
mr-hisa-child

スコア294

test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  Optional<Judge> judge = Stream.of(Judge.values()).filter(j -> j.a.equals(a) && j.b.equals(b)).findAny();
44
44
 
45
- return judge.get().message;
45
+ return judge.isPresent() ? judge.get().message : "";
46
46
 
47
47
  }
48
48