From 82014cbf6e00b68d87daeb692a096dbbe7f2281d Mon Sep 17 00:00:00 2001 From: tateisu Date: Mon, 15 Nov 2021 13:09:54 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=83=A9=E3=83=A0=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=8C=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/jp/juggler/util/Json.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/jp/juggler/util/Json.kt b/app/src/main/java/jp/juggler/util/Json.kt index 4b079eb3..c4a21452 100644 --- a/app/src/main/java/jp/juggler/util/Json.kt +++ b/app/src/main/java/jp/juggler/util/Json.kt @@ -12,7 +12,7 @@ class JsonException : RuntimeException { private const val CHAR0 = '\u0000' -private val reDecimal ="""(?:\A\-0\z)|[.eE]""".toRegex() +private val reDecimal = """(?:\A\-0\z)|[.eE]""".toRegex() // Tests if the value should be tried as a decimal. // It makes no test if there are actual digits. @@ -289,8 +289,9 @@ class JsonObject : LinkedHashMap() { if (value != defVal) put(key, value) } - fun putIfTrue(key: String, value: Boolean) = - putIfNotDefault(key, value, true) + fun putIfTrue(key: String, value: Boolean) { + if (value) put(key, value) + } } class JsonTokenizer(reader: Reader) {