Alone as an Island What’s the pride in being a Programmer?
Feb 11

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

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • description
  • Furl
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • TwitThis

Tags:

Leave a Reply

Give your best to the world.