Update HashSet to LinkedHashSet to keep order

feature/top10
Aurelien Hubert 7 years ago
parent d2f68d4e12
commit c7f385d1c8
  1. 8
      app/src/main/java/net/pokeranalytics/android/model/comparison/Comparator.kt

@ -45,7 +45,7 @@ fun List<Comparator>.combined(): List<List<QueryCondition>> {
this.forEach {
comparatorList.add(it.queryConditions)
}
return getCombinations(comparatorList)
return getCombinations(comparatorList)
}
inline fun <reified T : Filterable> List<QueryCondition>.query(realm: Realm): RealmQuery<T> {
@ -57,7 +57,7 @@ inline fun <reified T : Filterable> List<QueryCondition>.query(realm: Realm): Re
}
fun <T> getCombinations(lists: List<List<T>>): List<List<T>> {
var combinations: MutableSet<List<T>> = HashSet()
var combinations: MutableSet<List<T>> = LinkedHashSet()
var newCombinations: MutableSet<List<T>>
var index = 0
@ -69,10 +69,10 @@ fun <T> getCombinations(lists: List<List<T>>): List<List<T>> {
newList.add(i)
combinations.add(newList)
}
index++
index++
while (index < lists.size) {
val nextList = lists[index]
newCombinations = HashSet()
newCombinations = LinkedHashSet()
for (first in combinations) {
for (second in nextList) {
val newList = ArrayList<T>()

Loading…
Cancel
Save