Skip to content

Commit 8e51b31

Browse files
committed
Sync with underscore-java
1 parent 6eb9187 commit 8e51b31

File tree

12 files changed

+182
-240
lines changed

12 files changed

+182
-240
lines changed

pom-pack17.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
<option>-keepattributes Signature,InnerClasses</option>
9393
<option>-keep public class com.github.underscore.Underscore { *; }</option>
9494
<option>-keep public class com.github.underscore.*$Chain { *; }</option>
95-
<option>-keep public class com.github.underscore.Function3 { *; }</option>
96-
<option>-keep public class com.github.underscore.MemoizeFunction { *; }</option>
95+
<option>-keep public class com.github.underscore.Underscore.Function3 { *; }</option>
96+
<option>-keep public class com.github.underscore.Underscore.MemoizeFunction { *; }</option>
9797
<option>-keep public class com.github.underscore.Optional { *; }</option>
98-
<option>-keep public class com.github.underscore.PredicateIndexed { *; }</option>
99-
<option>-keep public class com.github.underscore.Template { *; }</option>
98+
<option>-keep public class com.github.underscore.Underscore.PredicateIndexed { *; }</option>
99+
<option>-keep public class com.github.underscore.Underscore.Template { *; }</option>
100100
<option>-keep public class com.github.underscore.Base32 { *; }</option>
101101
<option>-keep public class com.github.underscore.Json { *; }</option>
102102
<option>-keep public class com.github.underscore.U { *; }</option>

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

Lines changed: 0 additions & 28 deletions
This file was deleted.

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

Lines changed: 0 additions & 39 deletions
This file was deleted.

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

Lines changed: 0 additions & 28 deletions
This file was deleted.

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3809,4 +3809,27 @@ public static void main(String... args) {
38093809
+ "For docs, license, tests, and downloads, see: https://javadev.github.io/underscore-java";
38103810
System.out.println(message);
38113811
}
3812+
3813+
public static interface Function3<F1, F2, F3, T> {
3814+
T apply(F1 arg1, F2 arg2, F3 arg3);
3815+
}
3816+
3817+
public abstract static class MemoizeFunction<F, T> implements Function<F, T> {
3818+
private final Map<F, T> cache = new LinkedHashMap<>();
3819+
3820+
public abstract T calc(final F n);
3821+
3822+
public T apply(final F key) {
3823+
cache.putIfAbsent(key, calc(key));
3824+
return cache.get(key);
3825+
}
3826+
}
3827+
3828+
public static interface PredicateIndexed<T> {
3829+
boolean test(int index, T arg);
3830+
}
3831+
3832+
public static interface Template<T> extends Function<T, String> {
3833+
List<String> check(T arg);
3834+
}
38123835
}

0 commit comments

Comments
 (0)