welcome to my blargh

now with 88.333% more desu. repeating of course.

Lists in C# versus Java

Here's how you create and iterate over a list in C#:

Now, here's that same code in Java:

As you can see, the Java code is a bit more verbose. While C# defines its List class as a strongly typed class, Java treats its own as a very generic collection that requires you to cast elements as you access them. Also, C# does some synaptic sugar with its "foreach" statement that automatically accesses the iterator and loops through the collection.

Loading mentions Retweet

Filed under  //   c#   java   programming  
Posted December 7, 2009
// 1 Comment