Skip to content

Commit e860493

Browse files
committed
Sync with underscore-java.
1 parent 9bdb9dc commit e860493

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3795,10 +3795,11 @@ public static int minimumDays(int rows, int columns, List<List<Integer>> grid) {
37953795
private static int getInteger(int rows, int columns, List<List<Integer>> grid, Queue<int[]> queue, int cnt) {
37963796
int target = rows * columns;
37973797
int res = 0;
3798+
int localCnt = cnt;
37983799
int[][] dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
37993800
while (!queue.isEmpty()) {
38003801
int size = queue.size();
3801-
if (cnt == target) {
3802+
if (localCnt == target) {
38023803
return res;
38033804
}
38043805
for (int i = 0; i < size; i++) {
@@ -3807,7 +3808,7 @@ private static int getInteger(int rows, int columns, List<List<Integer>> grid, Q
38073808
int ni = cur[0] + dir[0];
38083809
int nj = cur[1] + dir[1];
38093810
if (ni >= 0 && ni < rows && nj >= 0 && nj < columns && grid.get(ni).get(nj) == 0) {
3810-
cnt++;
3811+
localCnt++;
38113812
queue.offer(new int[] {ni, nj});
38123813
grid.get(ni).set(nj, 1);
38133814
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* The MIT License (MIT)
33
*
4-
* Copyright 2015-2019 Valentyn Kolesnikov
4+
* Copyright 2015-2020 Valentyn Kolesnikov
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -2462,6 +2462,11 @@ public Builder add(final String key, final ArrayBuilder builder) {
24622462
return this;
24632463
}
24642464

2465+
public Builder add(final String key, final Builder builder) {
2466+
data.put(key, builder.build());
2467+
return this;
2468+
}
2469+
24652470
@SuppressWarnings("unchecked")
24662471
public Map<String, Object> build() {
24672472
return (Map<String, Object>) ((LinkedHashMap) data).clone();

0 commit comments

Comments
 (0)