Posted By


berndschiffer on 08/07/09

Tagged


Statistics


Viewed 545 times
Favorited by 0 user(s)

Stefans Lösung


/ Published in: Groovy
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def timeLogged (Closure c) {
  2. long start = - System.currentTimeMillis()
  3. c.call()
  4. println "duration in sec: " + (System.currentTimeMillis() + start) / 1000;
  5. }
  6.  
  7. def tueA() { tue('a') }
  8. def tueB() { tue('b') }
  9. def tueC() { tue('c') }
  10.  
  11. def tue(was) {
  12. println was
  13. sleep(100)
  14. }
  15.  
  16. timeLogged { tueA() }
  17. timeLogged { tueB() }
  18. timeLogged { tueC() }

URL: http://berndschiffer.blogspot.com/2009/08/beispiel-fur-refactoring-von-beispiel.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.