This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thoughtpropulsion.reactrode; | |
import static com.thoughtpropulsion.reactrode.Functional.returning; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.concurrent.atomic.AtomicReference; | |
import io.vavr.Tuple2; | |
import io.vavr.control.Option; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.Collections; | |
import org.apache.geode.cache.execute.Execution; | |
import org.apache.geode.cache.execute.FunctionService; | |
class Scratch { | |
public static void main(String[] args) { | |
final Execution<String, String, String> execution = FunctionService.onRegion(null); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static net.jodah.typetools.TypeResolver.resolveRawArgument; | |
public class Core { | |
interface Handler<T> { | |
void process(T x); | |
} | |
void p1(final String s) {} | |
void p1(final int i) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.List; | |
import java.util.function.BinaryOperator; | |
import java.util.function.Supplier; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicReference; | |
import java.util.function.Supplier; | |
class Memoize { | |
private Memoize() {} | |
/* | |
Props to AOL Cyclops Memoize for this little trick: using the UNSET reference | |
value as the sentinel for an uninitialized cache value. This approach allows memoization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
class Scratch { | |
interface Pool { | |
void basicDestroy(boolean keepAlive); | |
} | |
static class PoolImpl implements Pool { | |
@Override | |
public void basicDestroy(final boolean keepAlive) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.Optional; | |
import java.util.function.Function; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
class Scratch { | |
/* | |
A method that converts a String to an Integer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
class Scratch { | |
public static void main(String[] args) { | |
final List<String> original = | |
Stream.of("a", "b", null, "c") | |
.collect(Collectors.toList()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.ObjectOutputStream; | |
import java.io.Serializable; | |
import java.util.EnumSet; | |
class Scratch { | |
enum Fruit {APPLE, ORANGE}; | |
public static void main(String[] args) throws IOException { | |
final EnumSet<Fruit> fruits = EnumSet.of(Fruit.APPLE, Fruit.ORANGE); |
