This file contains hidden or 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.stream.IntStream; | |
public class Prime { | |
public static void main(String[] args) { | |
IntStream.rangeClosed(1, 100) | |
.filter(i -> IntStream.rangeClosed(2, (int) Math.sqrt(i)) | |
.noneMatch(j -> i % j == 0 && i != 1) | |
) | |
.forEach(System.out::println); |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
"strconv" | |
"time" | |
) | |
var done = make(chan string) | |
func producer(c chan<- string) { |
This file contains hidden or 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.function.Consumer; | |
class MailBuilder { | |
private String from; | |
private String to; | |
private String subject; | |
private String body; | |
public MailBuilder from(final String fromAddress) { | |
this.from = fromAddress; |
This file contains hidden or 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.Arrays; | |
import java.util.List; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
public class FunctionAndPredicate { |
This file contains hidden or 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.stream.Stream; | |
@FunctionalInterface | |
interface Call<T> { | |
Call<T> apply(); | |
default boolean isComplete() { | |
return false; |
NewerOlder