8000 methods-to-properties.7 : extract isIn · test-driven-development/code@89d5708 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89d5708

Browse files
Duncan McGregordmcg
authored andcommitted
methods-to-properties.7 : extract isIn
1 parent 4801f75 commit 89d5708

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/travelator/CampSites.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ fun Iterable<CampSite>.sitesInRegion(
55
region: String
66
): Set<CampSite> =
77
filter { site ->
8-
site.countryCode == countryISO &&
9-
site.region.equals(region, ignoreCase = true)
10-
}.toSet()
8+
site.isIn(countryISO, region)
9+
}.toSet()
10+
11+
fun CampSite.isIn(countryISO: String, region: String) =
12+
countryCode == countryISO &&
13+
this.region.equals(region, ignoreCase = true)

0 commit comments

Comments
 (0)
0