X

Geertjan's Blog

  • January 1, 2010

Simplification of Node Creation

Geertjan Wielenga
Product Manager
I received a bunch of comments from Jesse Glick about
How to Create a Web Service Client with Groovy and NetBeans Platform 6.8
. I'll be changing that article a lot, as a result.

Here's one of them:

     @Override
public void resultChanged(LookupEvent le) {
- quotes = new ArrayList<ShakesWsClient>();
- Collection<? extends ShakesWsClient> coll = result.allInstances();
- for (ShakesWsClient client : coll) {
- //Add all the ShakesWsClient in the context to the ArrayList:
- quotes.add(client);
- //Call "createKeys":
- refresh(true);
- }
-
+ quotes = new ArrayList<ShakesWsClient>(result.allInstances());
+ //Call "createKeys":
+ refresh(true);
}

I.e., no need to iterate through the result instances, just pass them in as the ArrayList parameter.

Join the discussion

Comments ( 1 )
  • Jeff Schwartz Saturday, January 2, 2010

    Groovyness would dictate that you forgo with the semicolons as well :)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.