Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
class Challenge {
private static final Logger log = LoggerFactory.getLogger(Challenge.class);
private void doSomething(Collection<String> words) {
log.debug("doing work on " + Joiner.on(";").join(words));
doWork(words);
}
//
private void doSomething_naiveSolution(Collection<String> words) {
if (log.isDebugEnabled()) {
log.debug("doing work on " + Joiner.on(";").join(words));
}
doWork(words);
}
private void doWork(Collection<String> words) {
// ...
}
}
Owner

yonatanm commented Aug 21, 2013

can you tweak the code so joiner will be invoked only when needed (as most of the time logger level is Info) ?
I'm looking for something like the doSomething_naiveSolution, but a cleaner one.

Do you find this position http://thoughtstostring.wordpress.com/2013/06/02/looking-for-an-outstanding-software-engineer/ interesting ? Can you solve this challenge ? contact me via twitter https://twitter.com/yonatanm or drop your CV via mail - yonatan [at] outbrain [dot] com.

Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment