Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the the check.
This commit is contained in:
@@ -141,7 +141,7 @@ final class AsciiBytes {
|
||||
public boolean matches(CharSequence name, char suffix) {
|
||||
int charIndex = 0;
|
||||
int nameLen = name.length();
|
||||
int totalLen = (nameLen + (suffix == 0 ? 0 : 1));
|
||||
int totalLen = (nameLen + (suffix != 0 ? 1 : 0));
|
||||
for (int i = this.offset; i < this.offset + this.length; i++) {
|
||||
int b = this.bytes[i];
|
||||
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
|
||||
@@ -250,7 +250,7 @@ final class AsciiBytes {
|
||||
}
|
||||
|
||||
public static int hashCode(int hash, char suffix) {
|
||||
return (suffix == 0 ? hash : (31 * hash + suffix));
|
||||
return (suffix != 0 ? (31 * hash + suffix) : hash);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||
parser.addVisitor(centralDirectoryVisitor());
|
||||
this.data = parser.parse(data, filter == null);
|
||||
this.type = type;
|
||||
this.manifestSupplier = manifestSupplier != null ? manifestSupplier : () -> {
|
||||
this.manifestSupplier = (manifestSupplier != null ? manifestSupplier : () -> {
|
||||
try (InputStream inputStream = getInputStream(MANIFEST_NAME)) {
|
||||
if (inputStream == null) {
|
||||
return null;
|
||||
@@ -130,7 +130,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private CentralDirectoryVisitor centralDirectoryVisitor() {
|
||||
|
||||
@@ -36,7 +36,7 @@ final class StringSequence implements CharSequence {
|
||||
private int hash;
|
||||
|
||||
StringSequence(String source) {
|
||||
this(source, 0, (source == null ? -1 : source.length()));
|
||||
this(source, 0, source != null ? source.length() : -1);
|
||||
}
|
||||
|
||||
StringSequence(String source, int start, int end) {
|
||||
|
||||
Reference in New Issue
Block a user