public static Optional<Type> elementTypeOf(Type type) {
        final Class<?> rawClass = GenericTypes.getErasedType(type);
        if (rawClass.isArray()) {
            return Optional.of(rawClass.getComponentType());
        } else if (Iterable.class.isAssignableFrom(rawClass)) {
            return GenericTypes.findGenericParameter(type, Iterable.class);
        } else if (Iterator.class.isAssignableFrom(rawClass)) {
            return GenericTypes.findGenericParameter(type, Iterator.class);
        } else { // not an iterable-like
            return Optional.empty();
        }
    }
Given an iterable-like type, try to determine its static (i.e, without looking at contents) element type.
core/src/main/java/org/jdbi/v3/core/internal/IterableLike.java