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:
Adrien Grand 2013-05-03 14:11:14 +00:00
parent b895ebde43
commit 64dfbfdfb2
1 changed files with 4 additions and 0 deletions

View File

@ -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) {