Skip to content

Commit 6d3aa29

Browse files
committed
Fix sonar warning.
1 parent dd6e0cb commit 6d3aa29

File tree

1 file changed

+6
-1
lines changed
  • src/main/java/com/github/underscore

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3255,7 +3255,12 @@ public List<T> slice(final int start, final int end) {
32553255
public static <T> List<List<T>> splitAt(final Iterable<T> iterable, final int position) {
32563256
List<List<T>> result = newArrayList();
32573257
int size = size(iterable);
3258-
int index = position < 0 ? 0 : (position > size ? size : position);
3258+
final int index;
3259+
if (position < 0) {
3260+
index = 0;
3261+
} else {
3262+
index = position > size ? size : position;
3263+
}
32593264
result.add(newArrayList(iterable).subList(0, index));
32603265
result.add(newArrayList(iterable).subList(index, size));
32613266
return result;

0 commit comments

Comments
 (0)