Skip to content

Commit dc71953

Browse files
committed
Sync with underscore-java.
1 parent aeacbbd commit dc71953

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ public T get() {
21822182
* Documented, #wrap
21832183
*/
21842184
public static <T> Function<Void, T> wrap(
2185-
final Function<T, T> function, final Function<Function<T, T>, T> wrapper) {
2185+
final UnaryOperator<T> function, final Function<UnaryOperator<T>, T> wrapper) {
21862186
return arg -> wrapper.apply(function);
21872187
}
21882188

@@ -3914,7 +3914,7 @@ private static List<Map.Entry<String, Integer>> getEntries(
39143914

39153915
public static class ValueThenKeyComparator<
39163916
K extends Comparable<? super K>, V extends Comparable<? super V>>
3917-
implements Comparator<Map.Entry<K, V>> {
3917+
implements Comparator<Map.Entry<K, V>>, java.io.Serializable {
39183918

39193919
public int compare(Map.Entry<K, V> a, Map.Entry<K, V> b) {
39203920
int cmp1 = b.getValue().compareTo(a.getValue());

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import java.util.function.Function;
3838
import java.util.function.Predicate;
3939
import java.util.function.Supplier;
40+
import java.util.function.UnaryOperator;
41+
4042
import org.junit.jupiter.api.Test;
4143

4244
/**
@@ -250,7 +252,7 @@ void once() {
250252
*/
251253
@Test
252254
void wrap() {
253-
Function<String, String> hello = name -> "hello: " + name;
255+
UnaryOperator<String> hello = name -> "hello: " + name;
254256
Function<Void, String> result =
255257
Underscore.wrap(hello, func -> "before, " + func.apply("moe") + ", after");
256258
assertEquals("before, hello: moe, after", result.apply(null));

0 commit comments

Comments
 (0)