From 748fe30adf8947f3ba9d8f8c1e35fe304d2458b3 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Fri, 21 Apr 2017 12:16:09 -0500 Subject: [PATCH] really fix, sloppy --- build.gradle | 2 +- src/main/kotlin/com/github/sanity/shoebox/OrderedViewSet.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 8734e1e..21931f6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'com.github.sanity' -version '0.2.6' +version '0.2.7' buildscript { ext.kotlin_version = '1.1.1' diff --git a/src/main/kotlin/com/github/sanity/shoebox/OrderedViewSet.kt b/src/main/kotlin/com/github/sanity/shoebox/OrderedViewSet.kt index 2eb06c4..ef6c987 100644 --- a/src/main/kotlin/com/github/sanity/shoebox/OrderedViewSet.kt +++ b/src/main/kotlin/com/github/sanity/shoebox/OrderedViewSet.kt @@ -14,7 +14,7 @@ class OrderedViewSet(val view : View, val viewKey : String, val comp init { val ol = ArrayList>() - val kvComparator : Comparator> = Comparator> { o1, o2 -> comparator.thenBy { o1.key.compareTo(o2.key) }.compare(o1.value, o2.value) } + val kvComparator : Comparator> = Comparator> { o1, o2 -> comparator.compare(o1.value, o2.value) }.thenBy(KeyValue::key) ol.addAll(view.getKeyValues(viewKey)) ol.sortWith(kvComparator) orderedList = ol @@ -22,7 +22,7 @@ class OrderedViewSet(val view : View, val viewKey : String, val comp val binarySearchResult = orderedList.betterBinarySearch(keyValue, kvComparator) val insertionPoint: Int = when (binarySearchResult) { is BinarySearchResult.Exact -> { - throw RuntimeException("Listener called for key/value already in list ($keyValue)") + throw RuntimeException("Listener called for key/value already in list keyValue: $keyValue orderedList[${binarySearchResult.index}] = ${orderedList[binarySearchResult.index]}") } is BinarySearchResult.Between -> binarySearchResult.highIndex }