Skip to content

Commit 72c5577

Browse files
authored
Resolved Idea warnings
1 parent 92a5cf7 commit 72c5577

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/main/java/com/github/underscore/Base32.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static String decode(final String encoded) {
5151
}
5252

5353
private byte[] decodeInternal(final String encoded) {
54-
if (encoded.length() == 0) {
54+
if (encoded.isEmpty()) {
5555
return new byte[0];
5656
}
5757
int encodedLength = encoded.length();

src/main/java/com/github/underscore/U.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.github.underscore;
2525

26-
import java.io.File;
2726
import java.io.FileInputStream;
2827
import java.io.FileOutputStream;
2928
import java.io.IOException;
@@ -2069,7 +2068,7 @@ public static long downloadUrl(final String url, final String fileName)
20692068
public static void decompressGzip(final String sourceFileName, final String targetFileName)
20702069
throws IOException {
20712070
try (GZIPInputStream gis =
2072-
new GZIPInputStream(new FileInputStream(new File(sourceFileName)))) {
2071+
new GZIPInputStream(new FileInputStream(sourceFileName))) {
20732072
Files.copy(gis, Paths.get(targetFileName));
20742073
}
20752074
}

src/main/java/com/github/underscore/Underscore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ public static <E> E first(final E... array) {
12551255
}
12561256

12571257
public static <E> List<E> first(final List<E> list, final int n) {
1258-
return list.subList(0, Math.min(n < 0 ? 0 : n, list.size()));
1258+
return list.subList(0, Math.min(Math.max(n, 0), list.size()));
12591259
}
12601260

12611261
public T first() {
@@ -1273,7 +1273,7 @@ public static <E> E first(final Iterable<E> iterable, final Predicate<E> pred) {
12731273
public static <E> List<E> first(
12741274
final Iterable<E> iterable, final Predicate<E> pred, final int n) {
12751275
List<E> list = filter(newArrayList(iterable), pred);
1276-
return list.subList(0, Math.min(n < 0 ? 0 : n, list.size()));
1276+
return list.subList(0, Math.min(Math.max(n, 0), list.size()));
12771277
}
12781278

12791279
public T first(final Predicate<T> pred) {

0 commit comments

Comments
 (0)