I am aware of a counter approach to do this. I was wondering if there is a nice and compact way to do this.
Legend - your answer could be improved upon; because if you fail numTries times, you swallow the exception. Much better:
numTries
while (true) { try { // break; } catch (Exception e ) { if (--numTries == 0) throw e; } }
2.1m questions
2.1m answers
60 comments
57.0k users