/** * Returns the value found at the specified index of the list as a long. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as a long. * @throws NumberFormatException if the value cannot be cast to a long. */ public long longValueAt(int index) { return ConfigurationSection.getLongValue(valueAt(index)); }
/** * Returns the value found at the specified index of the list as an integer. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as an integer. * @throws NumberFormatException if the value cannot be cast to an integer. */ public int integerValueAt(int index) { return ConfigurationSection.getIntegerValue(valueAt(index)); }
/** * Returns the value found at the specified index of the list as a double. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as a double. * @throws NumberFormatException if the value cannot be cast to a double. */ public double doubleValueAt(int index) { return ConfigurationSection.getDoubleValue(valueAt(index)); }
/** * Returns the value found at the specified index of the list as a boolean. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as a boolean. */ public boolean booleanValueAt(int index) { return ConfigurationSection.getBooleanValue(valueAt(index)); }
/** * Returns the value found at the specified index of the list as a float. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as a float. * @throws NumberFormatException if the value cannot be cast to a float. */ public float floatValueAt(int index) { return ConfigurationSection.getFloatValue(valueAt(index)); }
/** * Returns the value found at the specified index of the list as a {@link ValueList}. * @param index index of the value to retrieve. * @param separator string used to split the value into tokens. * @return the value found at the specified index of the list as a {@link ValueList}. */ public ValueList listValueAt(int index, String separator) { return ConfigurationSection.getListValue(valueAt(index), separator); }
/** * Tests the {@link ValueList#valueAt(int)} method. * @param values test data. */ protected void testStringValues(ValueList values) { assert values.size() == 7; for(int i = 0; i < 7; i++) assert Integer.toString(i + 1).equals(values.valueAt(i)); }