The Artima Developer Community
Sponsored Link

Java Buzz Forum
Closures with CollectionUtils

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matt Raible

Posts: 422
Nickname: mraible
Registered: Jul, 2003

Matt Raible is a J2EE Consultant in Denver, Colorado.
Closures with CollectionUtils Posted: Apr 13, 2005 8:14 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Matt Raible.
Original Post: Closures with CollectionUtils
Feed Title: Raible Designs ~ We Build Web Apps
Feed URL: http://static.raibledesigns.com/500.html
Feed Description: Opinions and tips on how to build web applications using Java. Currently using Hibernate, Struts, XHTML, CSS, Ant, JUnit and XDoclet.
Latest Java Buzz Posts
Latest Java Buzz Posts by Matt Raible
Latest Posts From Raible Designs ~ We Build Web Apps

Advertisement
Here's a pretty nifty trick for using closure's with Jakarta Commons CollectionUtils:


List list = new ArrayList();
...
CollectionUtils.forAllDo(list, new Closure() {
    public void execute(Object obj) {
    // execute something for each item obj
    }
});

I wonder if there's any performance hit from doing things this way vs. a good ol' Iterator? Hat tip to Anand Subramanian.

Read: Closures with CollectionUtils

Topic: Are Hippies all that's left? Previous Topic   Next Topic Topic: [Apr 7, 2005 02:19 PDT] 7 Links

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use