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
interface MyInterface { | |
void abstractMethod(); | |
default void defaultMethod() { | |
System.out.println("default method called"); | |
} | |
} |
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
void readFile(String file) throws IOException { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); | |
try (BufferedReader reader2 = reader) { | |
String line; | |
while ((line = reader2.readLine()) != null) { | |
System.out.println(line); | |
} | |
} | |
} |
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
1+1 | |
int x = 1+1 | |
System.out.println(x) | |
Thread.sleep(2000) | |
/vars | |
/types | |
/list | |
/l | |
/help | |
Set<String> set = new HashSet<String>() |
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
/ | |
1+1 | |
int x = 1+1 | |
System.out.println(x) | |
Thread.sleep(2000) | |
/vars | |
/types | |
int inc(int x) { return x+1; } | |
inc(5) | |
/list |
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
1+1 | |
int x = 1+1 | |
System.out.println(x) | |
Thread.sleep(2000) | |
/vars | |
/types | |
/list | |
/l | |
/help | |
Set<String> set = new HashSet<String>() |
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
1+1 | |
int x = 1+1 | |
System.out.println(x) | |
Thread.sleep(2000) | |
/vars | |
/types | |
/list | |
/l | |
/help | |
Set<String> set = new HashSet<String>() |
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
jshell> Optional.of("something").stream().forEach(System.out::println) | |
something | |
jshell> Optional.empty().stream().forEach(System.out::println) |
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
jshell> Optional.of("something").or(() -> Optional.of("empty")) | |
$9 ==> Optional[something] | |
jshell> Optional.empty().or(() -> Optional.of("empty")) | |
$10 ==> Optional[empty] |
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
jshell> Optional.of("something").orElseGet(() -> "empty") | |
$7 ==> "something" | |
jshell> Optional.empty().orElseGet(() -> "empty") | |
$8 ==> "empty" |
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
jshell> Optional.of("something").orElse("empty") | |
$5 ==> "something" | |
jshell> Optional.empty().orElse("empty") | |
$6 ==> "empty" |