!nonEmpty
with isEmpty
SC-R1018Standard Scala structures provide with both isEmpty
and nonEmpty
methods. Replacing !nonEmpty
with isEmpty
makes the code slightly more readable and easier to comprehend.
if (!list.nonEmpty) {
// do something
}
if (list.isEmpty) {
// do something
}