title: How to handle parsing numbers with same catch block?
body: <p>I come across a situation quite often where I need to parse a numerical value (e.g. with Integer.parseInt or Double.parseDouble) and I have multiple values. The problem is that I find myself having to duplicate the exception-handling and it becomes ugly. For instance, take the following code:</p>
  
  <pre><code>double lowVal, mediumVal, highVal;
  String lowString = "1.2", mediumString = "null", highString = "7.9";
  
  try {
      lowVal = parseDouble(lowString);
  } catch (NumberFormatException NaN) {
      //Don't care, just carry on trying to parse the rest...
  }
  
  try {
      mediumVal = parseDouble(mediumString);
  } catch (NumberFormatException NaN) {
      //Don't care, just carry on trying to parse the rest...
  }
  
  try {
      highVal = parseDouble(highString);
  } catch (NumberFormatException NaN) {
      //Don't care, just carry on trying to parse the rest...
  }
  </code></pre>
  
  <p>Is there a good pattern for dealing with this situation? </p>
  
  <p>I don't want to use a single-try catch because I want to continue parsing the rest of the numbers.</p>
  
  <p>I should mention that in this example, the values are not initialized but in actual program code they would be. The assignment should only occur if the string values are parseable.</p>