Last active
November 25, 2024 14:39
-
-
Save peter-lawrey/babc913fa06b25d859ec059a851f87c2 to your computer and use it in GitHub Desktop.
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 when; | |
public class When { | |
static class when { | |
boolean when = true; | |
} | |
@interface whėn { | |
String value(); | |
} | |
String test(@whėn("when") Object whėn) { | |
return switch(whėn) { | |
case @whėn("when") when when | |
when when . when -> "when?"; | |
default -> "if not now, "; | |
}; | |
} | |
public static void main(String[] args) { | |
System.out.print(new When().test("hi")); | |
System.out.println(new When().test(new when())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment