From a928f04fa6a2bd584ed97f585638cedfef2f20f8 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 4 Oct 2024 03:13:45 +0200 Subject: [PATCH] Using .entries instead of .values() --- .../codinux/banking/epcqrcode/parser/EpcQrCodeParser.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/parser/EpcQrCodeParser.kt b/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/parser/EpcQrCodeParser.kt index 3a9525f..ebdf0c0 100644 --- a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/parser/EpcQrCodeParser.kt +++ b/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/parser/EpcQrCodeParser.kt @@ -25,19 +25,19 @@ open class EpcQrCodeParser { } protected open fun parseEpcQrAfterSuccessfulFormatCheck(decodedQrCode: String, lines: List): ParseEpcQrCodeResult { - val validVersionCodes = EpcQrCodeVersion.values().map { it.code } + val validVersionCodes = EpcQrCodeVersion.entries.map { it.code } if (lines[1].length != 3 || validVersionCodes.contains(lines[1]) == false) { return createInvalidFormatResult(decodedQrCode, "The second line has to be exactly one of these values: ${validVersionCodes.joinToString(", ")}") } - val version = EpcQrCodeVersion.values().first { it.code == lines[1] } + val version = EpcQrCodeVersion.entries.first { it.code == lines[1] } val codingCode = lines[2].toIntOrNull() if (lines[2].length != 1 || codingCode == null || codingCode < 1 || codingCode > 8) { - return createInvalidFormatResult(decodedQrCode, "The third line has to be exactly one of these values: ${EpcQrCodeCharacterSet.values().map { it.code }.joinToString(", ")}") + return createInvalidFormatResult(decodedQrCode, "The third line has to be exactly one of these values: ${EpcQrCodeCharacterSet.entries.map { it.code }.joinToString(", ")}") } - val coding = EpcQrCodeCharacterSet.values().first { it.code == codingCode } + val coding = EpcQrCodeCharacterSet.entries.first { it.code == codingCode } if (lines[3].length != 3) { return createInvalidFormatResult(decodedQrCode, "The fourth line, ${lines[3]}, has to be exactly three characters long.")