Road to FOSDEM 2010

As most of you already know (if you don’t, never mind, I will forgive you :D), I’m going to give a lightning talk in the Free Java Dev room at FOSDEM about Groovy. The title will be “Groovy: the cool side of java” and basically it will be an hand-on speech. No slide, just code. I will start from a simple Java code and I will rewrite it in Groovy. During the demo/live I will give some basics explanation about how is groovy working and we will see the power and the value that Groovy add at the top of JVM compared with a static language like Java.

Here the code that I wrote:

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

class TestJava{
   public static void main(String[] args) {
      new DoStuffs().doIt();

class DoStuffs{

   public void doIt(){

   List al = new ArrayList();

   System.out.println("* Initial size of"+al.getClass()+" :  " + al.size() + " with elements "+al);


   System.out.println("* Final size of"+al.getClass()+" :  " + al.size() + " with elements "+al);
   System.out.println("* Let's add some stuffs");


   System.out.println("* Done "+al);

   System.out.println("- Before ordering"+al);
   System.out.println("- After ordering "+al);

   List al2 = al.subList(2,4);

   System.out.println("- Sublisting "+al2);

   if(al.size() > 0){
      for (int i=0; i< al.size(); i++) {
         al.set(i, al.get(i)+" \\o/ ");

      System.out.println("Let's show the element in the reverse order: ");
      for (int i=al.size()-1; i>=0; i--){
         System.out.println("<"+i+"> "+al.get(i));

   if(al != null){
      List sub = new ArrayList();

      for (int i=0; i< al.size(); i++) {
         String el = (String) al.get(i);
         if(el.contains("t")) {
      System.out.println("- After grep "+ sub);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s