Merge pull request #505 from KoenDG/intellij_performance_analysis

Changes suggested by Intellij in the category "Performance".
This commit is contained in:
Harald Kuhr 2019-11-04 08:43:22 +01:00 committed by GitHub
commit 306d8ac5f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -922,7 +922,7 @@ public final class FileUtil {
// A URL should never be able to represent an opaque URI, test anyway
throw new IllegalArgumentException("URI is not hierarchical");
}
if (path.equals("")) {
if (path.isEmpty()) {
throw new IllegalArgumentException("URI path component is empty");
}

View File

@ -88,7 +88,7 @@ public final class BeanUtil {
while (begIdx < pProperty.length() && begIdx >= 0) {
endIdx = pProperty.indexOf(".", endIdx + 1);
endIdx = pProperty.indexOf('.', endIdx + 1);
if (endIdx > 0) {
subProp = pProperty.substring(begIdx, endIdx);
begIdx = endIdx + 1;
@ -106,7 +106,7 @@ public final class BeanUtil {
Class[] paramClass = new Class[0];
int begBracket;
if ((begBracket = subProp.indexOf("[")) > 0) {
if ((begBracket = subProp.indexOf('[')) > 0) {
// An error if there is no matching bracket
if (!subProp.endsWith("]")) {
return null;

View File

@ -622,7 +622,7 @@ public class WildcardStringParser {
buffer.append("\n");
buffer.append(" Format: <state index>: <character> (<last free state>)");
buffer.append("\n");
buffer.append(" Number of strings parsed: " + totalNumberOfStringsParsed);
buffer.append(" Number of strings parsed: ").append(totalNumberOfStringsParsed);
buffer.append("\n");
}
return buffer.toString();

View File

@ -78,6 +78,7 @@ import java.awt.image.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -2627,7 +2628,7 @@ public final class PICTImageReader extends ImageReaderBase {
public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException {
// TODO: The images look slightly different in Preview.. Could indicate the color space is wrong...
return Arrays.asList(
return Collections.singletonList(
ImageTypeSpecifiers.createPacked(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
0xff0000, 0xff00, 0xff, 0xff000000, DataBuffer.TYPE_INT, false