Do not create single element list if only one candidate

This commit is contained in:
Simon Ogorodnik
2019-06-25 16:01:00 +03:00
committed by Mikhail Glukhikh
parent f434248cb7
commit dfd0042a5b
@@ -900,6 +900,7 @@ open class CandidateCollector(val components: InferenceComponents) {
fun bestCandidates(): List<Candidate> {
if (groupNumbers.isEmpty()) return emptyList()
if (groupNumbers.size == 1) return candidates
val result = mutableListOf<Candidate>()
var bestGroup = groupNumbers.first()
for ((index, candidate) in candidates.withIndex()) {