Skip to content

Commit

Permalink
Introduce version 1.14.
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev committed Aug 1, 2020
1 parent 3d7cf17 commit 4605db9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Include the following in your `pom.xml` for Maven:
<dependency>
<groupId>com.github.javadev</groupId>
<artifactId>underscore11</artifactId>
<version>1.13</version>
<version>1.14</version>
</dependency>
...
</dependencies>
Expand All @@ -34,7 +34,7 @@ Include the following in your `pom.xml` for Maven:
Gradle:

```groovy
compile 'com.github.javadev:underscore11:1.13'
compile 'com.github.javadev:underscore11:1.14'
```

Underscore-java is a java port of [Underscore.js](http://underscorejs.org/).
Expand Down
8 changes: 4 additions & 4 deletions pom-central.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.github.javadev</groupId>
<artifactId>underscore11</artifactId>
<packaging>jar</packaging>
<version>1.13</version>
<version>1.14</version>
<name>java 11 port of Underscore.js</name>
<description>The java 11 port of Underscore.js</description>
<url>https://github.com/javadev/underscore-java11</url>
Expand Down Expand Up @@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
Expand Down Expand Up @@ -117,13 +117,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions pom-pack.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.github.javadev</groupId>
<artifactId>underscore11</artifactId>
<packaging>jar</packaging>
<version>1.13</version>
<version>1.14</version>
<name>java 11 port of Underscore.js</name>
<description>The java 11 port of Underscore.js</description>
<url>https://github.com/javadev/underscore-java11</url>
Expand Down Expand Up @@ -51,7 +51,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
Expand Down Expand Up @@ -240,13 +240,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.github.javadev</groupId>
<artifactId>underscore11</artifactId>
<packaging>jar</packaging>
<version>1.13-SNAPSHOT</version>
<version>1.14-SNAPSHOT</version>
<name>java 11 port of Underscore.js</name>
<description>The java 11 port of Underscore.js</description>
<url>https://github.com/javadev/underscore-java11</url>
Expand Down Expand Up @@ -49,7 +49,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
Expand Down Expand Up @@ -204,13 +204,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/github/underscore/U.java
Original file line number Diff line number Diff line change
Expand Up @@ -3652,6 +3652,12 @@ protected static <T> List<T> newArrayList(final Iterable<T> iterable) {
return result;
}

protected static <T> List<T> newArrayList(final T object) {
final List<T> result = new ArrayList<T>();
result.add(object);
return result;
}

protected static <T> List<T> newArrayList(final Iterable<T> iterable, final int size) {
final List<T> result = new ArrayList<T>();
for (int index = 0; iterable.iterator().hasNext() && index < size; index += 1) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/github/underscore/lodash/U.java
Original file line number Diff line number Diff line change
Expand Up @@ -1653,14 +1653,19 @@ private static Object makeObjectForSetValue(Object value, final String key,
@SuppressWarnings("unchecked")
public static Map<String, Object> update(final Map<String, Object> map1, final Map<String, Object> map2) {
Map<String, Object> outMap = newLinkedHashMap();
for (String key : map2.keySet()) {
Object value2 = map2.get(key);
for (Map.Entry<String, Object> entry : map2.entrySet()) {
String key = entry.getKey();
Object value2 = entry.getValue();
if (map1.containsKey(key)) {
Object value1 = map1.get(key);
if (value1 instanceof Map && value2 instanceof Map) {
outMap.put(key, update((Map<String, Object>) value1, (Map<String, Object>) value2));
} else if (value1 instanceof List && value2 instanceof List) {
outMap.put(key, merge((List<Object>) value1, (List<Object>) value2));
} else if (value1 instanceof List) {
outMap.put(key, merge((List<Object>) value1, newArrayList(value2)));
} else if (value2 instanceof List) {
outMap.put(key, merge(newArrayList(value1), (List<Object>) value2));
} else {
outMap.put(key, value2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/github/underscore/FunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void throttle() {
final Integer[] counter = new Integer[] {0};
Supplier<Void> incr = new Supplier<Void>() { public Void get() {
counter[0]++; return null; } };
final Supplier<Void> throttleIncr = U.throttle(incr, 40);
final Supplier<Void> throttleIncr = U.throttle(incr, 50);
throttleIncr.get();
throttleIncr.get();
U.delay(throttleIncr, 16);
Expand Down

0 comments on commit 4605db9

Please sign in to comment.