for (int index : outOfBoundsIndices) { try {
sb.charAt(index);
fail("StringBuilder.charAt index: " + index + " does not throw IOOBE as expected");
} catch (IndexOutOfBoundsException ex) { // OK
}
try {
sbUtf16.charAt(index);
fail("StringBuilder.charAt index: " + index + " does not throw IOOBE as expected (UTF-16)");
} catch (IndexOutOfBoundsException ex) { // OK
}
try {
sbuf.charAt(index);
fail("StringBuffer.charAt index: " + index + " does not throw IOOBE as expected");
} catch (IndexOutOfBoundsException ex) { // OK
}
try {
sbufUtf16.charAt(index);
fail("StringBuffer.charAt index: " + index + " does not throw IOOBE as expected (UTF-16)");
} catch (IndexOutOfBoundsException ex) { // OK
}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.