File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .List ;
4
4
5
5
import static java .util .Comparator .comparing ;
6
- import static travelator . Collections . sorted ;
6
+ import static java . util . stream . Collectors . toUnmodifiableList ;
7
7
import static travelator .Other .SOME_COMPLICATED_RESULT ;
8
+ import static travelator .Collections .sorted ;
8
9
import static travelator .Other .routesFor ;
9
10
import static travelator .Routes .getDepartsFrom ;
10
11
@@ -29,15 +30,16 @@ static List<Journey> longestJourneysIn(
29
30
30
31
public static List <List <Journey >> routesToShowFor (String itineraryId ) {
31
32
var routes = routesFor (itineraryId );
32
- routes = removeUnbearableRoutes (routes );
33
+ routes = bearable (routes );
33
34
return routes ;
34
35
}
35
36
36
- private static List <List <Journey >> removeUnbearableRoutes
37
+ private static List <List <Journey >> bearable
37
38
(List <List <Journey >> routes
38
39
) {
39
- routes .removeIf (route -> sufferScoreFor (route ) > 10 );
40
- return routes ;
40
+ return routes .stream ()
41
+ .filter (route -> sufferScoreFor (route ) <= 10 )
42
+ .collect (toUnmodifiableList ());
41
43
}
42
44
43
45
private static int sufferScore (
You can’t perform that action at this time.
0 commit comments