Java Streams Preview vs .Net LINQ

I’ve started following this very promising blog by the “Geeks From Paradise”. Apart from the fact that I’m a bit envious of geeks living in Costa Rica, this comparison of the upcoming Java 8 Streams API with various of .NET’s LINQ API capabilities is a very interesting read. A preview of what you’ll find there (just one of 19 examples):


List<string> nameList1 = new List(){ 
  "Anders", "David", "James",
  "Jeff", "Joe", "Erik" };
nameList1.Select(c => "Hello! " + c).ToList()
         .ForEach(c => Console.WriteLine(c));

Java Streams

List<String> nameList1 = asList(
  "Anders", "David", "James",
  "Jeff", "Joe", "Erik");
     .map(c -> "Hello! " + c)

Read the full blog post here:

4 thoughts on “Java Streams Preview vs .Net LINQ

  1. The C# code can be replace for the most clear:

    var nameList1 = new List(){ "Anders", "David", "James", "Jeff", "Joe", "Erik" };
    nameList1.Select(c => "Hello! " + c).ToList()

    Note that the foreach instruction accepts the method name too

Leave a Reply to dejavumaster Cancel reply