Skip to content

Commit 4605db9

Browse files
committed
Introduce version 1.14.
1 parent 3d7cf17 commit 4605db9

File tree

7 files changed

+28
-17
lines changed

7 files changed

+28
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Include the following in your `pom.xml` for Maven:
2525
<dependency>
2626
<groupId>com.github.javadev</groupId>
2727
<artifactId>underscore11</artifactId>
28-
<version>1.13</version>
28+
<version>1.14</version>
2929
</dependency>
3030
...
3131
</dependencies>
@@ -34,7 +34,7 @@ Include the following in your `pom.xml` for Maven:
3434
Gradle:
3535

3636
```groovy
37-
compile 'com.github.javadev:underscore11:1.13'
37+
compile 'com.github.javadev:underscore11:1.14'
3838
```
3939

4040
Underscore-java is a java port of [Underscore.js](http://underscorejs.org/).

pom-central.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.github.javadev</groupId>
66
<artifactId>underscore11</artifactId>
77
<packaging>jar</packaging>
8-
<version>1.13</version>
8+
<version>1.14</version>
99
<name>java 11 port of Underscore.js</name>
1010
<description>The java 11 port of Underscore.js</description>
1111
<url>https://github.com/javadev/underscore-java11</url>
@@ -50,7 +50,7 @@
5050
<plugin>
5151
<groupId>org.apache.maven.plugins</groupId>
5252
<artifactId>maven-compiler-plugin</artifactId>
53-
<version>3.8.0</version>
53+
<version>3.8.1</version>
5454
<configuration>
5555
<source>11</source>
5656
<target>11</target>
@@ -117,13 +117,13 @@
117117
<dependency>
118118
<groupId>junit</groupId>
119119
<artifactId>junit</artifactId>
120-
<version>4.12</version>
120+
<version>4.13</version>
121121
<scope>test</scope>
122122
</dependency>
123123
<dependency>
124124
<groupId>org.awaitility</groupId>
125125
<artifactId>awaitility</artifactId>
126-
<version>4.0.2</version>
126+
<version>4.0.3</version>
127127
<scope>test</scope>
128128
</dependency>
129129
</dependencies>

pom-pack.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.github.javadev</groupId>
66
<artifactId>underscore11</artifactId>
77
<packaging>jar</packaging>
8-
<version>1.13</version>
8+
<version>1.14</version>
99
<name>java 11 port of Underscore.js</name>
1010
<description>The java 11 port of Underscore.js</description>
1111
<url>https://github.com/javadev/underscore-java11</url>
@@ -51,7 +51,7 @@
5151
<plugin>
5252
<groupId>org.apache.maven.plugins</groupId>
5353
<artifactId>maven-compiler-plugin</artifactId>
54-
<version>3.8.0</version>
54+
<version>3.8.1</version>
5555
<configuration>
5656
<source>10</source>
5757
<target>10</target>
@@ -240,13 +240,13 @@
240240
<dependency>
241241
<groupId>junit</groupId>
242242
<artifactId>junit</artifactId>
243-
<version>4.12</version>
243+
<version>4.13</version>
244244
<scope>test</scope>
245245
</dependency>
246246
<dependency>
247247
<groupId>org.awaitility</groupId>
248248
<artifactId>awaitility</artifactId>
249-
<version>4.0.2</version>
249+
<version>4.0.3</version>
250250
<scope>test</scope>
251251
</dependency>
252252
</dependencies>

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.github.javadev</groupId>
66
<artifactId>underscore11</artifactId>
77
<packaging>jar</packaging>
8-
<version>1.13-SNAPSHOT</version>
8+
<version>1.14-SNAPSHOT</version>
99
<name>java 11 port of Underscore.js</name>
1010
<description>The java 11 port of Underscore.js</description>
1111
<url>https://github.com/javadev/underscore-java11</url>
@@ -49,7 +49,7 @@
4949
<plugin>
5050
<groupId>org.apache.maven.plugins</groupId>
5151
<artifactId>maven-compiler-plugin</artifactId>
52-
<version>3.8.0</version>
52+
<version>3.8.1</version>
5353
<configuration>
5454
<source>11</source>
5555
<target>11</target>
@@ -204,13 +204,13 @@
204204
<dependency>
205205
<groupId>junit</groupId>
206206
<artifactId>junit</artifactId>
207-
<version>4.12</version>
207+
<version>4.13</version>
208208
<scope>test</scope>
209209
</dependency>
210210
<dependency>
211211
<groupId>org.awaitility</groupId>
212212
<artifactId>awaitility</artifactId>
213-
<version>4.0.2</version>
213+
<version>4.0.3</version>
214214
<scope>test</scope>
215215
</dependency>
216216
</dependencies>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,6 +3652,12 @@ protected static <T> List<T> newArrayList(final Iterable<T> iterable) {
36523652
return result;
36533653
}
36543654

3655+
protected static <T> List<T> newArrayList(final T object) {
3656+
final List<T> result = new ArrayList<T>();
3657+
result.add(object);
3658+
return result;
3659+
}
3660+
36553661
protected static <T> List<T> newArrayList(final Iterable<T> iterable, final int size) {
36563662
final List<T> result = new ArrayList<T>();
36573663
for (int index = 0; iterable.iterator().hasNext() && index < size; index += 1) {

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,14 +1653,19 @@ private static Object makeObjectForSetValue(Object value, final String key,
16531653
@SuppressWarnings("unchecked")
16541654
public static Map<String, Object> update(final Map<String, Object> map1, final Map<String, Object> map2) {
16551655
Map<String, Object> outMap = newLinkedHashMap();
1656-
for (String key : map2.keySet()) {
1657-
Object value2 = map2.get(key);
1656+
for (Map.Entry<String, Object> entry : map2.entrySet()) {
1657+
String key = entry.getKey();
1658+
Object value2 = entry.getValue();
16581659
if (map1.containsKey(key)) {
16591660
Object value1 = map1.get(key);
16601661
if (value1 instanceof Map && value2 instanceof Map) {
16611662
outMap.put(key, update((Map<String, Object>) value1, (Map<String, Object>) value2));
16621663
} else if (value1 instanceof List && value2 instanceof List) {
16631664
outMap.put(key, merge((List<Object>) value1, (List<Object>) value2));
1665+
} else if (value1 instanceof List) {
1666+
outMap.put(key, merge((List<Object>) value1, newArrayList(value2)));
1667+
} else if (value2 instanceof List) {
1668+
outMap.put(key, merge(newArrayList(value1), (List<Object>) value2));
16641669
} else {
16651670
outMap.put(key, value2);
16661671
}

src/test/java/com/github/underscore/FunctionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void throttle() {
120120
final Integer[] counter = new Integer[] {0};
121121
Supplier<Void> incr = new Supplier<Void>() { public Void get() {
122122
counter[0]++; return null; } };
123-
final Supplier<Void> throttleIncr = U.throttle(incr, 40);
123+
final Supplier<Void> throttleIncr = U.throttle(incr, 50);
124124
throttleIncr.get();
125125
throttleIncr.get();
126126
U.delay(throttleIncr, 16);

0 commit comments

Comments
 (0)