Czy jest stosowne wedle standardów w Javie, aby używać w konstrukcji try pętli? Czy jest to zalecane czy lepiej nie praktykować takiej implementacji?
static int countOccurrenceLetter(String str, char sign, ArrayList<String> returnValue) {
String strSign = Character.toString(sign);
int i = str.indexOf(sign);
try {
while (str.substring(i, i + 1).equals(strSign)) {
returnValue.add(strSign);
i++;
}
} catch (StringIndexOutOfBoundsException e) {}
return i;
}