mirror of https://github.com/apache/lucene.git
LUCENE-4946: Re-add the random-access checks that have been lost during refactoring.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1478801 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b895ebde43
commit
64dfbfdfb2
|
@ -42,6 +42,8 @@ public final class CollectionUtil {
|
|||
|
||||
ListIntroSorter(List<T> list, Comparator<? super T> comp) {
|
||||
super();
|
||||
if (!(list instanceof RandomAccess))
|
||||
throw new IllegalArgumentException("CollectionUtil can only sort random access lists in-place.");
|
||||
this.list = list;
|
||||
this.comp = comp;
|
||||
}
|
||||
|
@ -77,6 +79,8 @@ public final class CollectionUtil {
|
|||
@SuppressWarnings("unchecked")
|
||||
ListTimSorter(List<T> list, Comparator<? super T> comp, int maxTempSlots) {
|
||||
super(maxTempSlots);
|
||||
if (!(list instanceof RandomAccess))
|
||||
throw new IllegalArgumentException("CollectionUtil can only sort random access lists in-place.");
|
||||
this.list = list;
|
||||
this.comp = comp;
|
||||
if (maxTempSlots > 0) {
|
||||
|
|
Loading…
Reference in New Issue