From 031558e48fc41fc2270621a98493bdc0c12f7e4c Mon Sep 17 00:00:00 2001 From: Horimatsu Takuya Date: Wed, 12 Jun 2024 12:52:05 +0900 Subject: [PATCH] fix: Type and Generics --- .../horitaku1124/kotlin/sql_minus/utils/BTree23.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/github/horitaku1124/kotlin/sql_minus/utils/BTree23.kt b/src/main/kotlin/com/github/horitaku1124/kotlin/sql_minus/utils/BTree23.kt index b16007e..1b60831 100644 --- a/src/main/kotlin/com/github/horitaku1124/kotlin/sql_minus/utils/BTree23.kt +++ b/src/main/kotlin/com/github/horitaku1124/kotlin/sql_minus/utils/BTree23.kt @@ -2,7 +2,7 @@ package com.github.horitaku1124.kotlin.sql_minus.utils import java.util.* -class BTree23 (var comparator: (T, T) -> Int) { +class BTree23 (var comparator: (T, T) -> Int) { var values = arrayListOf() var left: BTree23? = null @@ -15,7 +15,7 @@ class BTree23 (var comparator: (T, T) -> Int) { return } if (values.size == 1) { - var diff = comparator(values[0], value) + val diff = comparator(values[0], value) if (diff < 0) { values.add(value) } else if (diff > 0) { @@ -24,7 +24,7 @@ class BTree23 (var comparator: (T, T) -> Int) { return } if (values.size == 2) { - var diff = comparator(values[0], value) + val diff = comparator(values[0], value) if (diff > 0) { if (left == null) { left = BTree23(comparator) @@ -34,7 +34,7 @@ class BTree23 (var comparator: (T, T) -> Int) { } else if (diff == 0) { return } - var diff2 = comparator(value, values[1]) + val diff2 = comparator(value, values[1]) if (diff2 < 0) { if (middle == null) { middle = BTree23(comparator) @@ -78,7 +78,7 @@ class BTree23 (var comparator: (T, T) -> Int) { } return false } - fun findObj(value: T): Optional { + fun findObj(value: T): Optional { if (values.size == 0) return Optional.empty() if (values.size == 1) { if(comparator(value, values[0]) == 0) {