Skip to content

Commit d501838

Browse files
Duncan McGregordmcg
authored andcommitted
single-expressions.15 : Inline atIndex
1 parent 26eef74 commit d501838

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.idea/codeStyles/Project.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/travelator/EmailAddress.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ data class EmailAddress(
1010
companion object {
1111
@JvmStatic
1212
fun parse(value: String): EmailAddress {
13-
val atIndex = value.lastIndexOf('@')
14-
return atIndex.let { atIndex -> // <1>
13+
return value.lastIndexOf('@').let { atIndex ->
1514
require(!(atIndex < 1 || atIndex == value.length - 1)) {
1615
"EmailAddress must be two parts separated by @"
1716
}

0 commit comments

Comments
 (0)