Skip to content

Commit

Permalink
Sync with underscore-java
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev committed Jul 31, 2023
1 parent 6eb9187 commit 8e51b31
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 240 deletions.
8 changes: 4 additions & 4 deletions pom-pack17.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@
<option>-keepattributes Signature,InnerClasses</option>
<option>-keep public class com.github.underscore.Underscore { *; }</option>
<option>-keep public class com.github.underscore.*$Chain { *; }</option>
<option>-keep public class com.github.underscore.Function3 { *; }</option>
<option>-keep public class com.github.underscore.MemoizeFunction { *; }</option>
<option>-keep public class com.github.underscore.Underscore.Function3 { *; }</option>
<option>-keep public class com.github.underscore.Underscore.MemoizeFunction { *; }</option>
<option>-keep public class com.github.underscore.Optional { *; }</option>
<option>-keep public class com.github.underscore.PredicateIndexed { *; }</option>
<option>-keep public class com.github.underscore.Template { *; }</option>
<option>-keep public class com.github.underscore.Underscore.PredicateIndexed { *; }</option>
<option>-keep public class com.github.underscore.Underscore.Template { *; }</option>
<option>-keep public class com.github.underscore.Base32 { *; }</option>
<option>-keep public class com.github.underscore.Json { *; }</option>
<option>-keep public class com.github.underscore.U { *; }</option>
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/com/github/underscore/Function3.java

This file was deleted.

39 changes: 0 additions & 39 deletions src/main/java/com/github/underscore/MemoizeFunction.java

This file was deleted.

28 changes: 0 additions & 28 deletions src/main/java/com/github/underscore/PredicateIndexed.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/main/java/com/github/underscore/Template.java

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/com/github/underscore/Underscore.java
Original file line number Diff line number Diff line change
Expand Up @@ -3809,4 +3809,27 @@ public static void main(String... args) {
+ "For docs, license, tests, and downloads, see: https://javadev.github.io/underscore-java";
System.out.println(message);
}

public static interface Function3<F1, F2, F3, T> {
T apply(F1 arg1, F2 arg2, F3 arg3);
}

public abstract static class MemoizeFunction<F, T> implements Function<F, T> {
private final Map<F, T> cache = new LinkedHashMap<>();

public abstract T calc(final F n);

public T apply(final F key) {
cache.putIfAbsent(key, calc(key));
return cache.get(key);
}
}

public static interface PredicateIndexed<T> {
boolean test(int index, T arg);
}

public static interface Template<T> extends Function<T, String> {
List<String> check(T arg);
}
}
Loading

0 comments on commit 8e51b31

Please sign in to comment.