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
| #!/bin/bash | |
| message_volume=30 | |
| # Check if at least one argument is provided | |
| if [ $# -eq 0 ]; then | |
| echo "Usage: $0 \"9\" \"1:30\" \"15:00\"" | |
| exit 1 | |
| fi |
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
| Thread t = new Thread(() -> System.out.println("hello guadalajara")) | |
| t.start() | |
| ExecutorService e = Executors.newSingleThreadExecutor() | |
| Future<String> f = e.submit(() -> "hello guadalajara") | |
| f | |
| f.get() | |
| ExecutorService e = ForkJoinPool.commonPool() | |
| Future<String> f = e.submit(() -> "hello guadalajara") | |
| f.get() | |
| CompletableFuture<String> cf = new CompletableFuture<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
| var x = "hello" | |
| /v x | |
| var list = new ArrayList<String>() | |
| /v list | |
| int x | |
| var x | |
| var x = null | |
| var x = (Integer) null | |
| int x=0, y=0 | |
| var x=0, y=0 |
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
| HttpHandler handler = he -> { | |
| String body = "hello confoo"; | |
| he.sendResponseHeaders(200, body.length()); | |
| try (OutputStream os = he.getResponseBody()) { | |
| os.write(body.getBytes()); | |
| } | |
| } | |
| /l handler | |
| HttpServer hs = HttpServer.create(new InetSocketAddress(8000), 0) |
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
| var x = "hello" | |
| /v x | |
| var list = new ArrayList<String>() | |
| /v list | |
| int x | |
| var x | |
| var x = null | |
| var x = (Integer) null | |
| int x=0, y=0 | |
| var x=0, y=0 |
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
| Set<Integer> set = new HashSet<Integer>() | |
| set.add(1) | |
| set.add(2) | |
| set.add(3) | |
| set = Collections.unmodifiableSet(set) | |
| Collections.unmodifiableSet(new HashSet<>Arrays.asList(1,2,3))) | |
| Collections.unmodifiableSet(new HashSet<>Arrays.asList(1,2,3)) | |
| Collections.unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3))) | |
| Collections.unmodifiableSet(new HashSet<Integer>() {{ add(1); add(2); add(3); }}) | |
| ImmutableSet.of(1,2,3) |
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
| List<Integer> list = new ArrayList<Integer>() | |
| list.add(1) | |
| list.add(2) | |
| list.add(3) | |
| list = Collections.unmodifiableList(list) | |
| Collections.unmodifiableList(Arrays.asList(1,2,3)) | |
| Collections.unmodifiableList(Stream.of(1,2,3).collect(toList())) | |
| Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }}) | |
| /env -class-path guava-27.1-jre.jar | |
| import com.google.common.collect.ImmutableList |
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
| Thread t = new Thread(() -> System.out.println("hello guadalajara")) | |
| t.start() | |
| ExecutorService e = Executors.newSingleThreadExecutor() | |
| Future<String> f = e.submit(() -> "hello guadalajara") | |
| f | |
| f.get() | |
| ExecutorService e = ForkJoinPool.commonPool() | |
| Future<String> f = e.submit(() -> "hello guadalajara") | |
| f.get() | |
| CompletableFuture<String> cf = new CompletableFuture<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
| List<Integer> list = new ArrayList<Integer>() | |
| list.add(1) | |
| list.add(2) | |
| list.add(3) | |
| list = Collections.unmodifiableList(list) | |
| Collections.unmodifiableList(Arrays.asList(1,2,3)) | |
| Collections.unmodifiableList(Stream.of(1,2,3).collect(toList())) | |
| Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }} ) | |
| /env -class-path guava-27.1-jre.jar | |
| import com.google.common.collect.ImmutableList |
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
| var x = "hello" | |
| /v x | |
| var list = new ArrayList<String>() | |
| /v list | |
| int x | |
| var x | |
| var x = null | |
| var x = (Integer) null | |
| int x=0, y=0 | |
| var x=0, y=0 |
NewerOlder