Skip to content

Commit f8b8af4

Browse files
authored
Found another Scala 2 isNullOrEmpty
1 parent 430252a commit f8b8af4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

_overviews/scala3-book/domain-modeling-tools.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ Here’s an example of a “string utilities” object that contains a set of me
219219
object StringUtils:
220220
def truncate(s: String, length: Int): String = s.take(length)
221221
def containsWhitespace(s: String): Boolean = s.matches(".*\\s.*")
222-
def isNullOrEmpty(s: String): Boolean =
223-
if s == null || s.trim.equals("") then true else false
222+
def isNullOrEmpty(s: String): Boolean = s==null || s.trim.isEmpty
224223
```
225224

226225
We can use the object as follows:

0 commit comments

Comments
 (0)