Created
June 11, 2012 22:58
-
-
Save Fabszn/2913252 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
public class LambdaJBenchmark implements Benchmark { | |
public void iterateSimpleList(final List<String> lines) { | |
convert(lines, new Converter<Object, Object>() { | |
public Object convert(Object o) { | |
return o; | |
} | |
}); | |
} | |
} | |
public class JavaBenchmark implements Benchmark { | |
public void iterateSimpleList(final List<String> lines) { | |
final List<Line> l = new ArrayList<Line>(); | |
for (String s : lines) { | |
StringTokenizer st = new StringTokenizer(s); | |
final Line line = new Line(s, st.countTokens(), 0); | |
l.add(line); | |
} | |
} | |
} | |
public class GuavaBenchmark implements Benchmark { | |
private Map<String, List<Long>> context = Maps.newHashMap(); | |
public void iterateSimpleList(final List<String> lines) { | |
List<Line> l = Lists.transform(lines, new Function<String, Line>() { | |
public Line apply(@Nullable String s) { | |
System.out.println(s); | |
StringTokenizer st = new StringTokenizer(s); | |
final Line line = new Line(s, st.countTokens(), 0); | |
return line; | |
} | |
}); | |
} | |
} | |
public interface Benchmark { | |
public void iterateSimpleList(final List<String> lines); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment