Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Sahnwaldt jcsahnwaldt

View GitHub Profile
@jcsahnwaldt
jcsahnwaldt / ProcFunc.java
Created Mar 10, 2015
Microbenchmark: procedural vs functional extraction of error lines. See https://twitter.com/jcsahnwaldt/status/574705132555923456
View ProcFunc.java
import java.util.*;
import java.util.stream.*;
import static java.util.stream.Collectors.*;
import java.io.*;
import java.nio.file.*;
public class ProcFunc {
public static <T> Iterator<T> limit(Iterator<? extends T> it, int max) {
return new Iterator<T>() {
@jcsahnwaldt
jcsahnwaldt / ToMap.java
Last active Aug 29, 2015
Microbenchmark: Convert list to map with or without streams / lambdas. Result: Performance is the same. See https://stackoverflow.com/questions/674639/scala-best-way-of-turning-a-collection-into-a-map-by-key/3249462#comment46124673_3249462
View ToMap.java
import java.util.*;
import java.util.stream.*;
import static java.util.stream.Collectors.*;
import java.util.function.*;
class Value {
private final String key;
public Value(String key) {
You can’t perform that action at this time.