Fix compiler warning and avoid useless assignation to local variable.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1478870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2013-05-03 16:48:03 +00:00
parent a7bcad65eb
commit d46e7bbdb5
3 changed files with 8 additions and 8 deletions

View File

@ -657,8 +657,7 @@ public final class ArrayUtil {
*/
public static <T extends Comparable<? super T>> void introSort(T[] a, int fromIndex, int toIndex) {
if (toIndex-fromIndex <= 1) return;
final Comparator<T> comp = naturalComparator();
introSort(a, fromIndex, toIndex, comp);
introSort(a, fromIndex, toIndex, ArrayUtil.<T>naturalComparator());
}
/**
@ -698,8 +697,7 @@ public final class ArrayUtil {
*/
public static <T extends Comparable<? super T>> void timSort(T[] a, int fromIndex, int toIndex) {
if (toIndex-fromIndex <= 1) return;
final Comparator<T> comp = naturalComparator();
timSort(a, fromIndex, toIndex, comp);
timSort(a, fromIndex, toIndex, ArrayUtil.<T>naturalComparator());
}
/**

View File

@ -17,6 +17,7 @@ package org.apache.lucene.util;
* limitations under the License.
*/
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@ -145,8 +146,7 @@ public final class CollectionUtil {
public static <T extends Comparable<? super T>> void introSort(List<T> list) {
final int size = list.size();
if (size <= 1) return;
final Comparator<T> comp = ArrayUtil.naturalComparator();
introSort(list, comp);
introSort(list, ArrayUtil.<T>naturalComparator());
}
// Tim sorts:
@ -172,8 +172,7 @@ public final class CollectionUtil {
public static <T extends Comparable<? super T>> void timSort(List<T> list) {
final int size = list.size();
if (size <= 1) return;
final Comparator<T> comp = ArrayUtil.naturalComparator();
timSort(list, comp);
timSort(list, ArrayUtil.<T>naturalComparator());
}
}

View File

@ -187,8 +187,11 @@ public abstract class Sorter {
switch (i - l) {
case 2:
swap(l + 1, l + 2);
swap(l, l + 1);
break;
case 1:
swap(l, l + 1);
break;
case 0:
break;
default: