Skip to content

Instantly share code, notes, and snippets.

@paavohuhtala
Created February 27, 2015 00:23
Show Gist options
  • Save paavohuhtala/47c9aced826fd4e9b67d to your computer and use it in GitHub Desktop.
Save paavohuhtala/47c9aced826fd4e9b67d to your computer and use it in GitHub Desktop.
c# LINQ vs java streams
private ArrayList<String> distinct() {
return (ArrayList<String>) list.stream().distinct().collect(Collectors.toList());
}
vs
private List<string> Distinct()
{
return list.Distinct().ToList();
}
private int count(String type) {
return (int) list.stream().filter((t) -> t.equals(type)).count();
}
vs
private int Count(string type) {
return list.Count(l => l == type);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment