You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2013/05/03 18:48:04 UTC
svn commit: r1478870 - in
/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util:
ArrayUtil.java CollectionUtil.java Sorter.java
Author: jpountz
Date: Fri May 3 16:48:03 2013
New Revision: 1478870
URL: http://svn.apache.org/r1478870
Log:
Fix compiler warning and avoid useless assignation to local variable.
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/CollectionUtil.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Sorter.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java?rev=1478870&r1=1478869&r2=1478870&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/ArrayUtil.java Fri May 3 16:48:03 2013
@@ -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());
}
/**
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/CollectionUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/CollectionUtil.java?rev=1478870&r1=1478869&r2=1478870&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/CollectionUtil.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/CollectionUtil.java Fri May 3 16:48:03 2013
@@ -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());
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Sorter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Sorter.java?rev=1478870&r1=1478869&r2=1478870&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Sorter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Sorter.java Fri May 3 16:48:03 2013
@@ -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: