All Questions
Tagged with control-structures exceptions
3 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 (!...
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.
...
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 )
...