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
## the typo is that in line 7, we should add to newCollection. | |
## Intellij is able to reason that we only ever go through the loop once, and offset < 8 is always false | |
while (!collection.isEmpty() && offset < 8) { | |
var newCollection = new HashSet<>(); | |
for (var x : collection) { | |
if (someCondition(x)) { | |
collection.add(derivedValue(x)); | |
} | |
} |
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
Benchmark (stringLength) (successPct) Mode Cnt Score Error Units | |
EmailBenchmark.testMyMatcher 16 .1 avgt 43.356 ns/op | |
EmailBenchmark.testMyMatcher 16 .5 avgt 85.844 ns/op | |
EmailBenchmark.testMyMatcher 16 .9 avgt 127.384 ns/op | |
EmailBenchmark.testMyMatcher 256 .1 avgt 232.553 ns/op | |
EmailBenchmark.testMyMatcher 256 .5 avgt 1234.144 ns/op | |
EmailBenchmark.testMyMatcher 256 .9 avgt 1826.578 ns/op | |
EmailBenchmark.testMyMatcher 4096 .1 avgt 3465.675 ns/op | |
EmailBenchmark.testMyMatcher 4096 .5 avgt 17361.246 ns/op | |
EmailBenchmark.testMyMatcher 4096 .9 avgt 33907.657 ns/op |
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.justinblank; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.concurrent.TimeUnit; | |
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) | |
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) | |
@Fork(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
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.io.Serializable; | |
public class TestClass implements Serializable { | |
private TestClass testClass; |
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
/** | |
* Represents a typed computation that may either return a result or a meaningful error | |
* @param <E> the type of errors that are tracked | |
* @param <V> the type of values that are computed | |
*/ | |
public class Result<E, V> { | |
private final E error; | |
private final V value; |
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 date = Date.now(); | |
var array = []; | |
for (var i = 0; i < 2000000; i++) { | |
array.push(Math.random()); | |
} | |
console.log(Date.now() - date); | |
array.sort(); | |
for (var j = 0; j< 5; j++) { | |
console.log(array[j]); | |
} |
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
import java.util.Optional; | |
public class OptionalTest { | |
public OptionalTest() { | |
// TODO Auto-generated constructor stub | |
} | |
public static void main(String[] args) { | |
try { |
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
x =: 3 5 $ 3 1 4 2 | |
x * x | |
9 1 16 4 9 | |
1 16 4 9 1 | |
16 4 9 1 16 | |
x +/ x | |
0 1 2 3 4 5 6 7 8 | |
1 2 3 4 5 6 7 8 9 |
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
{ | |
"name": "Show/Hide Hidden Text", | |
"version": "1", | |
"manifest_version": 2, | |
"description": "Shows and hides all text hidden in hide tags.", | |
"content_scripts": [ | |
{"matches" : ["http://lifein19x19.com/*", | |
"http://www.lifein19x19.com/*"], | |
"js": ["showhide.js"] | |
} |