mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 03:37:34 -08:00
Another possible improvement against https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37905&q=label%3AProj-zxing
This commit is contained in:
parent
490769e75f
commit
50ead4f658
|
@ -25,6 +25,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Deque;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -301,7 +302,7 @@ public final class HighLevelEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<State> simplifyStates(Iterable<State> states) {
|
private static Collection<State> simplifyStates(Iterable<State> states) {
|
||||||
Collection<State> result = new LinkedList<>();
|
Deque<State> result = new LinkedList<>();
|
||||||
for (State newState : states) {
|
for (State newState : states) {
|
||||||
boolean add = true;
|
boolean add = true;
|
||||||
for (Iterator<State> iterator = result.iterator(); iterator.hasNext();) {
|
for (Iterator<State> iterator = result.iterator(); iterator.hasNext();) {
|
||||||
|
@ -315,7 +316,7 @@ public final class HighLevelEncoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (add) {
|
if (add) {
|
||||||
result.add(newState);
|
result.addFirst(newState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue