Tuesday, November 15, 2011

drop thread.sleep(), use timeunit's sleep()

Everybody has a Thread.sleep() call somewhere in his code.
sleep() method only accepts milliseconds and if you need some sleep functionality with another time granularity you have either to calculate the sum of milliseconds and put a magic number in the code
or a more readable way to do it
Thread.sleep(1000L * 60 * 60 * 24);
or a much more readable way;
More beautiful code right?