From 4ab78f4028576bfbdc67c73be140d0122a8f15b8 Mon Sep 17 00:00:00 2001 From: Jonas Tobias Hopusch Date: Sun, 19 Sep 2021 20:23:26 +0200 Subject: [PATCH] Avoid unnecessary temporary variable in short-hand translation --- src/main/kotlin/de/jotoho/waituntil/start.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/de/jotoho/waituntil/start.kt b/src/main/kotlin/de/jotoho/waituntil/start.kt index 16a0ce6..7a4275c 100644 --- a/src/main/kotlin/de/jotoho/waituntil/start.kt +++ b/src/main/kotlin/de/jotoho/waituntil/start.kt @@ -23,9 +23,8 @@ fun main(args: Array) { options.add(arg.substring(startIndex=2)) } else if (arg.startsWith('-')) { - val translation = optionDictionary[arg] - if (translation != null) - options.add(translation.substring(startIndex=2)) + if (optionDictionary.containsKey(arg)) + options.add(optionDictionary[arg]!!.substring(startIndex=2)) else System.err.println("Short-hand '$arg' does not exist. Ignoring!") }