News for hackers. Stuff that matters.
Re:Why I absolutely love java by kenjackson on Tuesday February 08, 2011 @07:00PM (#2195505)
In fairness to the Java version, you should probably add all the additional stuff.

   using System.Linq;
   class Filter
   {
       static void Main()
       {
           var a = new []{1, 2, 3, 4}.Where(x=>x%2==0);
           System.Console.WriteLine(a);
       }
   }
It's unclear if printing is necessary or not, as the Java one does an explicit print, but the others don't.
Re:Why I absolutely love java by lfborjas on Tuesday February 08, 2011 @07:13PM (#2195553)
The other ones are meant to be run in a REPL, but java doesn't have one (lest you count beanshell, which ships with a really old version of java, one before generics) so I had to print it explicitly
Re:Why I absolutely love java by nrkn on Tuesday February 08, 2011 @08:06PM (#2195713)

  using System.Linq;
  class F {
    static void Main() {
      new[] {1, 2, 3, 4}.Where( i => i % 2 > 0 ).ToList().ForEach( 
        System.Console.WriteLine 
      );
    }
  }
Re:Why I absolutely love java by TeHCrAzY on Tuesday February 08, 2011 @10:25PM (#2196128)
It's always irritated me that ForEach isn't available on IEnumerable<T>