Skip to content

Commit 66db2a2

Browse files
Duncan McGregordmcg
authored andcommitted
single-expressions.9 : Lift return
1 parent 5660789 commit 66db2a2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/travelator/EmailAddress.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ data class EmailAddress(
1313
return emailAddress(value, value.lastIndexOf('@'))
1414
}
1515

16-
private fun emailAddress(value: String, atIndex: Int): EmailAddress {
17-
return if ((atIndex < 1 || atIndex == value.length - 1)) {
16+
private fun emailAddress(value: String, atIndex: Int): EmailAddress =
17+
if ((atIndex < 1 || atIndex == value.length - 1)) {
1818
throw IllegalArgumentException(
1919
"EmailAddress must be two parts separated by @"
2020
)
@@ -24,6 +24,5 @@ data class EmailAddress(
2424
value.substring(atIndex + 1)
2525
)
2626
}
27-
}
2827
}
2928
}

0 commit comments

Comments
 (0)