Skip to content

Commit 5abdee8

Browse files
committed
refactor(model-server): improve boolean condition readability
Use simpler versions avoiding negations or null checks.
1 parent 0ebf41f commit 5abdee8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

model-server/src/main/kotlin/org/modelix/model/server/handlers/KeyValueLikeModelServer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ val PERMISSION_MODEL_SERVER = "model-server".asResource()
6060
val MODEL_SERVER_ENTRY = KeycloakResourceType("model-server-entry", KeycloakScope.READ_WRITE_DELETE)
6161

6262
private fun toLong(value: String?): Long {
63-
return if (value == null || value.isEmpty()) 0 else value.toLong()
63+
return if (value.isNullOrEmpty()) 0 else value.toLong()
6464
}
6565

6666
private class NotFoundException(description: String?) : RuntimeException(description)
@@ -260,7 +260,7 @@ class KeyValueLikeModelServer(
260260
val processed: MutableSet<String> = HashSet()
261261
val pending: MutableSet<String> = HashSet()
262262
pending.add(rootKey)
263-
while (!pending.isEmpty()) {
263+
while (pending.isNotEmpty()) {
264264
val keys: List<String> = ArrayList(pending)
265265
pending.clear()
266266
val values = storeClient.getAll(keys)

0 commit comments

Comments
 (0)