The Source for Java Technology Collaboration
User: Password:



Start New Message Post a Reply

Subject:  Closures once again...
Date:  2007-08-16 13:25:32
From:  scotty69


In Javaland, we should sometimes look over the rim of our coffee cup. It's not only Ruby or Groovy going for closures:


class Program
{
static void Main(string[] args)
{
List<string> names = new List<string>();
names.Add("Dave");
names.Add("John");
names.Add("Abe");
names.Add("Barney");

string abe = names.Find(name =>
name.Equals("Abe"));
Console.WriteLine(abe);
}
}


(hope the formatting works, no preview...)

Looks a lot like Java, but in fact it's C# 3.0, where they call it Lambda Expressions. And they aggressively go even further (have a look at the LINQ stuff)

 Feed java.net RSS Feeds