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.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.SynchronousQueue; | |
import java.util.concurrent.ThreadFactory; |
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.HashSet; | |
import java.util.Set; | |
import java.util.function.Consumer; | |
class Scratch { | |
public static void main(String[] args) { | |
final Set<Integer> a = Set.of(1, 2, 3); | |
final Set<Integer> b = Set.of(3, 4, 5); | |
System.out.println("intersection: " + intersect(a, b)); | |
} |
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.server; | |
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import com.thoughtpropulsion.reactrode.model.Cell; | |
import com.thoughtpropulsion.reactrode.model.CoordinateSystem; | |
import com.thoughtpropulsion.reactrode.model.GameOfLife; |
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 functional | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.channels.ReceiveChannel | |
import kotlinx.coroutines.channels.produce | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
import kotlinx.coroutines.selects.select | |
@FunctionalInterface |
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 kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.channels.ReceiveChannel | |
import kotlinx.coroutines.channels.produce | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
import kotlinx.coroutines.selects.select | |
sealed class State { | |
/** | |
* Process the first input from the channel(s) [perform a side-effect] and return a new functional.State |
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 java.lang.Thread.sleep; | |
import java.time.LocalDateTime; | |
import java.util.Collection; | |
public class CallCoroutineFromJava { | |
public static void main(String[] args) throws InterruptedException { | |
final JavaCallableCoroutineScope jccs = new JavaCallableCoroutineScope(); |
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 kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.ReceiveChannel | |
import kotlinx.coroutines.channels.produce | |
import kotlinx.coroutines.channels.ticker | |
import kotlinx.coroutines.selects.select | |
import java.time.LocalDateTime | |
fun log2(msg:String) { | |
println("$msg in thread ${Thread.currentThread()}") | |
} |
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 kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.cancelChildren | |
import kotlinx.coroutines.channels.ReceiveChannel | |
import kotlinx.coroutines.channels.produce | |
import kotlinx.coroutines.channels.ticker | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
import kotlinx.coroutines.selects.select | |
import java.time.LocalDateTime |
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 static java.util.concurrent.TimeUnit.NANOSECONDS; | |
import java.util.Random; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicReference; | |
import reactor.core.Disposable; |
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.rxperiment; | |
import static com.thoughtpropulsion.reactrode.Functional.returning; | |
import static java.lang.System.currentTimeMillis; | |
import static java.lang.System.nanoTime; | |
import static org.assertj.core.api.Assertions.assertThat; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.time.Duration; |
NewerOlder