/** * Returns the 0-based index of the item the current loop is handling. * So, if this is the first iteration, then the index will be 0. If * you {@link #skip} ahead in this loop, those skipped iterations will * still be reflected in the index. If iteration has not begun, this * will return {@code null}. * @return current loop index */ public Integer getIndex() { Integer count = getCount(); if (count == null || count == 0) { return null; } return count - 1; }
/** * Returns the 0-based index of the item the specified loop is handling. * So, if this is the first iteration, then the index will be 0. If * you {@link #skip} ahead in this loop, those skipped iterations will * still be reflected in the index. If iteration has not begun, this * will return {@code null}. * @param name loop name * @return current loop index */ public Integer getIndex(String name) { Integer count = getCount(name); if (count == null || count == 0) { return null; } return count - 1; }
return getCount(key.substring(6, key.length()));