Skip to main content

All Questions

1 vote
2 answers
2k views

Is it valid to expect/throw an exception using a custom caching system?

Imagine some code like the following: class Cache { private Map<String, String> values = new HashMap<String, String>(); public String getFromCache(String key) { if (!...
Kristof's user avatar
  • 2,241
3 votes
2 answers
5k views

Try Catch and Flow Control dilemma

I am aware that doing Flow Control on a program using a try-catch block is bad practice, but I can't see how to do it in another way when the error caught needs a redirection of the code's execution. ...
mFeinstein's user avatar
39 votes
4 answers
8k views

Why are brackets required for try-catch?

In various languages (Java at least, think also C#?) you can do things like if( condition ) singleStatement; while( condition ) singleStatement; for( var; condition; increment ) ...
Svish's user avatar
  • 1,102