Changes suggested by Intellij in the category "Performance".

Updated.
This commit is contained in:
Koen De Groote 2019-10-22 01:58:08 +02:00
parent 42e17f2063
commit 8ed5f06151
5 changed files with 11 additions and 9 deletions

View File

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

View File

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

View File

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

View File

@ -54,6 +54,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
/** /**
@ -196,7 +197,7 @@ public final class BMPImageReader extends ImageReaderBase {
checkBounds(pImageIndex); checkBounds(pImageIndex);
// TODO: Better implementation, include INT_RGB types for 3BYTE_BGR and 4BYTE_ABGR for INT_ARGB // TODO: Better implementation, include INT_RGB types for 3BYTE_BGR and 4BYTE_ABGR for INT_ARGB
return Arrays.asList(getRawImageType(pImageIndex)).iterator(); return Collections.singletonList(getRawImageType(pImageIndex)).iterator();
} }
@Override @Override

View File

@ -78,6 +78,7 @@ import java.awt.image.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -181,7 +182,7 @@ public final class PICTImageReader extends ImageReaderBase {
readPICTHeader0(pStream); readPICTHeader0(pStream);
} }
} }
private void readPICTHeader0(final ImageInputStream pStream) throws IOException { private void readPICTHeader0(final ImageInputStream pStream) throws IOException {
// Get size // Get size
picSize = pStream.readUnsignedShort(); picSize = pStream.readUnsignedShort();
@ -325,7 +326,7 @@ public final class PICTImageReader extends ImageReaderBase {
/** /**
* Reads the PICT stream. * Reads the PICT stream.
* The contents of the stream will be drawn onto the supplied graphics * The contents of the stream will be drawn onto the supplied graphics
* object. * object.
* <p> * <p>
* If "DEBUG" is true, the elements read are listed on stdout. * If "DEBUG" is true, the elements read are listed on stdout.
@ -510,7 +511,7 @@ public final class PICTImageReader extends ImageReaderBase {
ovSize.setLocation(x, y); ovSize.setLocation(x, y);
/* /*
ovSize.x *= 2;// Don't know why, but has to be multiplied by 2 ovSize.x *= 2;// Don't know why, but has to be multiplied by 2
ovSize.y *= 2; ovSize.y *= 2;
*/ */
if (DEBUG) { if (DEBUG) {
@ -2627,7 +2628,7 @@ public final class PICTImageReader extends ImageReaderBase {
public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException { public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException {
// TODO: The images look slightly different in Preview.. Could indicate the color space is wrong... // TODO: The images look slightly different in Preview.. Could indicate the color space is wrong...
return Arrays.asList( return Collections.singletonList(
ImageTypeSpecifiers.createPacked( ImageTypeSpecifiers.createPacked(
ColorSpace.getInstance(ColorSpace.CS_sRGB), ColorSpace.getInstance(ColorSpace.CS_sRGB),
0xff0000, 0xff00, 0xff, 0xff000000, DataBuffer.TYPE_INT, false 0xff0000, 0xff00, 0xff, 0xff000000, DataBuffer.TYPE_INT, false