private void bindList(final Named key, final List<Object> values, final ConfigValue configValue) {
if (values.isEmpty()) {
bindList(key, INT_LIST, Collections.<Integer>emptyList());
bindList(key, DOUBLE_LIST, Collections.<Double>emptyList());
bindList(key, BOOL_LIST, Collections.<Boolean>emptyList());
bindList(key, STRING_LIST, Collections.<String>emptyList());
} else {
final Object head = values.get(0);
if (head instanceof Integer) {
bindList(key, INT_LIST, collectFrom(values, Integer.class));
} else if (head instanceof Long) {
bindList(key, LONG_LIST, collectFrom(values, Long.class));
} else if (head instanceof Double) {
bindList(key, DOUBLE_LIST, collectFrom(values, Double.class));
} else if (head instanceof Boolean) {
bindList(key, BOOL_LIST, collectFrom(values, Boolean.class));
} else if (head instanceof String) {
bindList(key, STRING_LIST, collectFrom(values, String.class));
} else {
throw unexpectedListType(head, configValue);
}
}
}