mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Unnecessary boxing to compare primitives inspection applied
This commit is contained in:
@@ -21,7 +21,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.textCompletion.DefaultTextCompletionValueDescriptor;
|
||||
import com.intellij.util.textCompletion.TextCompletionProvider;
|
||||
import com.intellij.util.textCompletion.TextFieldWithCompletion;
|
||||
import com.intellij.util.textCompletion.ValuesCompletionProvider;
|
||||
import com.intellij.util.textCompletion.ValuesCompletionProvider.ValuesCompletionProviderDumbAware;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -54,7 +53,7 @@ public class PushTargetTextField extends TextFieldWithCompletion {
|
||||
return new ValuesCompletionProviderDumbAware<>(new DefaultTextCompletionValueDescriptor.StringValueDescriptor() {
|
||||
@Override
|
||||
public int compare(String item1, String item2) {
|
||||
return Integer.valueOf(ContainerUtil.indexOf(targetVariants, item1)).compareTo(ContainerUtil.indexOf(targetVariants, item2));
|
||||
return Integer.compare(ContainerUtil.indexOf(targetVariants, item1), ContainerUtil.indexOf(targetVariants, item2));
|
||||
}
|
||||
}, targetVariants);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pegov
|
||||
@@ -216,7 +216,7 @@ public class PopupPositionManager {
|
||||
}
|
||||
else {
|
||||
// ok, popup does not fit, will try to resize it
|
||||
final java.util.List<Rectangle> boxes = new ArrayList<>();
|
||||
final List<Rectangle> boxes = new ArrayList<>();
|
||||
// right
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + myGap, myRelativeOnScreen.y,
|
||||
myScreenRect.width, myScreenRect.height)));
|
||||
@@ -234,8 +234,8 @@ public class PopupPositionManager {
|
||||
myScreenRect.width, myScreenRect.height)));
|
||||
|
||||
Collections.sort(boxes, (o1, o2) -> {
|
||||
final int i = new Integer(o1.width).compareTo(o2.width);
|
||||
return i == 0 ? new Integer(o1.height).compareTo(o2.height) : i;
|
||||
final int i = Integer.compare(o1.width, o2.width);
|
||||
return i == 0 ? Integer.compare(o1.height, o2.height) : i;
|
||||
});
|
||||
|
||||
final Rectangle suitableBox = boxes.get(boxes.size() - 1);
|
||||
|
||||
+2
-2
@@ -137,9 +137,9 @@ public class SourceFolderImpl extends ContentFolderBaseImpl implements SourceFol
|
||||
SourceFolderImpl sourceFolder = (SourceFolderImpl)folder;
|
||||
i = getPackagePrefix().compareTo(sourceFolder.getPackagePrefix());
|
||||
if (i!= 0) return i;
|
||||
i = Boolean.valueOf(isTestSource()).compareTo(sourceFolder.isTestSource());
|
||||
i = Boolean.compare(isTestSource(), sourceFolder.isTestSource());
|
||||
if (i != 0) return i;
|
||||
i = Boolean.valueOf(isForGeneratedSources()).compareTo(sourceFolder.isForGeneratedSources());
|
||||
i = Boolean.compare(isForGeneratedSources(), sourceFolder.isForGeneratedSources());
|
||||
if (i != 0) return i;
|
||||
//todo[nik] perhaps we should use LinkedSet instead of SortedSet and get rid of this method
|
||||
return myJpsElement.getRootType().getClass().getName().compareTo(sourceFolder.getRootType().getClass().getName());
|
||||
|
||||
+2
-3
@@ -64,8 +64,7 @@ public class GenericPatchApplier {
|
||||
Collections.addAll(myLines, LineTokenizer.tokenize(text, false));
|
||||
myBaseFileEndsWithNewLine = StringUtil.endsWithLineBreak(text);
|
||||
myHunks = hunks;
|
||||
final Comparator<TextRange> textRangeComparator =
|
||||
(o1, o2) -> new Integer(o1.getStartOffset()).compareTo(new Integer(o2.getStartOffset()));
|
||||
final Comparator<TextRange> textRangeComparator = Comparator.comparingInt(TextRange::getStartOffset);
|
||||
myTransformations = new TreeMap<>(textRangeComparator);
|
||||
myNotExact = new ArrayList<>();
|
||||
myNotBound = new ArrayList<>();
|
||||
@@ -1319,7 +1318,7 @@ public class GenericPatchApplier {
|
||||
|
||||
@Override
|
||||
public int compare(SplitHunk o1, SplitHunk o2) {
|
||||
return Integer.valueOf(o1.getStartLineBefore()).compareTo(Integer.valueOf(o2.getStartLineBefore()));
|
||||
return Integer.compare(o1.getStartLineBefore(), o2.getStartLineBefore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HackSearchTest extends TestCase {
|
||||
private static class ZComparator implements Comparator<Z> {
|
||||
@Override
|
||||
public int compare(Z o1, Z o2) {
|
||||
return new Integer(o1.getInt()).compareTo(new Integer(o2.getInt()));
|
||||
return Integer.compare(o1.getInt(), o2.getInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Suggestion implements Comparable<Suggestion> {
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull Suggestion o) {
|
||||
int c = new Integer(getMetrics()).compareTo(o.getMetrics());
|
||||
int c = Integer.compare(getMetrics(), o.getMetrics());
|
||||
return c != 0 ? c : StringUtil.compare(word, o.word, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user