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 example; | |
public class NamedParamsExample { | |
public static void main(String... args) { | |
foo("Bob", 29); | |
foo(new FooParams(){{name="Bob"; age=30; }}); | |
foo(Foo.name("Bob").age(31)); | |
} | |
static void foo(String name, Integer age) { |
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 com.benjiweber.example; | |
import java.util.Random; | |
public class ExceptionUnions { | |
public static void main(String... args) { | |
try { | |
foo().check(); | |
} catch (Eint eint) { |
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 com.benjiweber.example; | |
import org.junit.Test; | |
import java.util.Optional; | |
import static org.junit.Assert.assertEquals; | |
import static com.benjiweber.recordmixins.OptionalPatternMatchTest.None.*; | |
public class OptionalPatternMatchTest2 { |
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 com.benjiweber.example; | |
import org.junit.Test; | |
import java.util.Optional; | |
import static org.junit.Assert.assertEquals; | |
import static com.benjiweber.recordmixins.OptionalPatternMatchTest.None.*; | |
public class OptionalPatternMatchTest { |
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 com.benjiweber; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.function.Supplier; | |
public class ConditionalFuture { | |
public static void main(String... args) throws ExecutionException, InterruptedException { |
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 example; | |
public class Example { | |
public static void main(String... args) { | |
var duck = (Quacks & Waddles) Mixin::create; | |
// this works as the intersection type is inferred. | |
methodThatDoesDucklikeThings(duck); |
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 com.benjiweber.anontypes; | |
import java.util.*; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
import java.util.function.UnaryOperator; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; |