Scala

Scala

Made by DeepSource

Replace !isEmpty with nonEmpty SC-R1017

Anti-pattern
Minor

Standard Scala structures provide with both isEmpty and nonEmpty methods. Thefore, replacing !isEmpty with nonEmpty makes the code slightly more readable and easier to comprehend.

Bad Practice

if (!list.isEmpty) {
  // do something
}

Recommended

if (list.nonEmpty) {
  // do something
}