Mind.random()

random ramblings of an eccentric programmer

Peek View of Java 7.0 (Dolphin)

Here are some interesting features of Java 7.0

Using array syntax for collections access.

For example, instead of writing this:

List content = new ArrayList(10);

content.add(0, "Bean");

content.add(1, "Picks");

String name = content.get(0);

you will be writing..

List content = new ArrayList(10);

content[0] = "Bean";

content[1] = "Picks";

String name = content[0];

You can also initialize your List as

ArrayList content = {"Bean", "Picks", "Techno", "Blog"}

Most of the time we write so much code for accessing the getters and setters of beans. Consider you have a bean called Point, we generally write..

Point p = new Point();

p.setX(56);

p.setY(87);

int z = p.getX();

Now, with Dolphin, you could write

Point p = new Point();

p->X = 56;

p->Y = 87;

int z = p->X;

and your Point class will now look like this :

public class Point {

  public int property x;

  public int property y;

}

Cool. Isn’t it?

Visit : www.ibm.com for more info

=dgr-btw01JavaFuture (Java 7.0)

Comments