public int getSheetIndex(String name) {
int retval = -1;
- for (int k = 0; k < boundsheets.size(); k++) {
+ final int size = boundsheets.size();
+ for (int k = 0; k < size; k++) {
String sheet = getSheetName(k);
if (sheet.equalsIgnoreCase(name)) {
*/
@Override
public int getSheetIndex(org.apache.poi.ss.usermodel.Sheet sheet) {
- for(int i=0; i<_sheets.size(); i++) {
- if(_sheets.get(i) == sheet) {
- return i;
- }
- }
- return -1;
+ return _sheets.indexOf(sheet);
}
/**
case Workbook.SHEET_STATE_HIDDEN: break;
case Workbook.SHEET_STATE_VERY_HIDDEN: break;
default: throw new IllegalArgumentException("Invalid sheet state : " + state + "\n" +
- "Sheet state must beone of the Workbook.SHEET_STATE_* constants");
+ "Sheet state must be one of the Workbook.SHEET_STATE_* constants");
}
}