-
-
Save ceki/4bf89b14e688a10a1165dd619c9c5b16 to your computer and use it in GitHub Desktop.
Overloading of lambdas
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 org.slf4j.skunk; | |
| import java.util.function.Supplier; | |
| public class API { | |
| public static void main(String[] args) { | |
| API api = new API(); | |
| Integer i0 = 0; | |
| Integer i1 = 1; | |
| Supplier supplier0 = () -> i0; | |
| Supplier supplier1 = () -> i1; | |
| api.anArg(i0); | |
| api.anArg(supplier0); | |
| api.manyArgs(i0, i1); | |
| api.manyArgs(supplier0, supplier0); | |
| api.manyArgs(i0, supplier0); | |
| } | |
| void anArg(Object arg) { | |
| System.out.println("anArg(Object) called"); | |
| } | |
| void anArg(Supplier arg) { | |
| System.out.println("anArg(Supplier) called"); | |
| } | |
| void manyArgs(Object... arg) { | |
| System.out.println("manyArgs(Object...) called"); | |
| } | |
| void manyArgs(Supplier... arg) { | |
| System.out.println("manyArgs(Supplier...) called"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment