This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java 8 dates and functional programming to write a timer  RSS feed

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A question in the forum got me to write a timer. This was my first time instinctively doing so in Java 8. The result made for a nice blog post
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16006
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It reminds me of something similar I wrote in Scala.

Scala has a nicer syntax than Java to do this. With this method, you can just wrap the code you want to time in a time { ... } block:

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
 
Piet Souris
Rancher
Posts: 1939
66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can combine the two, like in


Greetz,
Piet
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!