Skip to content

Instantly share code, notes, and snippets.

@yonatanm
Last active October 9, 2016 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yonatanm/6287167 to your computer and use it in GitHub Desktop.
Save yonatanm/6287167 to your computer and use it in GitHub Desktop.
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) {
// ...
}
}
@yonatanm
Copy link
Author

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