com.autonomousapps.internal.utils.comparators.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dependency-analysis-gradle-plugin Show documentation
Show all versions of dependency-analysis-gradle-plugin Show documentation
Analyzes dependency usage in Android and JVM projects
// Copyright (c) 2024. Tony Robalik.
// SPDX-License-Identifier: Apache-2.0
package com.autonomousapps.internal.utils
internal class LexicographicIterableComparator> : Comparator> {
override fun compare(left: Iterable?, right: Iterable?): Int {
if (left === right) return 0
if (left == null || right == null) return if (left == null) -1 else 1
val leftIterator = left.iterator()
val rightIterator = right.iterator()
while (leftIterator.hasNext() && rightIterator.hasNext()) {
val compareResult = leftIterator.next().compareTo(rightIterator.next())
if (compareResult != 0) {
return compareResult
}
}
if (leftIterator.hasNext()) return 1
if (rightIterator.hasNext()) return -1
return 0
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy