8000 methods-to-properties.6 : convert CampSites to Kotlin · test-driven-development/code@4801f75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4801f75

Browse files
Duncan McGregordmcg
authored andcommitted
methods-to-properties.6 : convert CampSites to Kotlin
1 parent 571faa0 commit 4801f75

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/main/java/travelator/CampSites.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
package travelator
22

3-
import java.util.stream.Collectors
4-
5-
fun Set<CampSite>.sitesInRegion(
3+
fun Iterable<CampSite>.sitesInRegion(
64
countryISO: String,
75
region: String
8-
): Set<CampSite> {
9-
return stream()
10-
.filter { campSite: CampSite ->
11-
campSite.countryCode == countryISO &&
12-
campSite.region.equals(region, ignoreCase = true)
13-
}
14-
.collect(Collectors.toUnmodifiableSet())
15-
}
6+
): Set<CampSite> =
7+
filter { site ->
8+
site.countryCode == countryISO &&
9+
site.region.equals(region, ignoreCase = true)
10+
}.toSet()

0 commit comments

Comments
 (0)
0