/** * @return The type parameters as an array */ @SuppressWarnings("ToArrayCallWithZeroLengthArrayArgument") default Argument[] getTypeParameters() { Collection<Argument<?>> values = getTypeVariables().values(); return values.toArray(new Argument[0]); }
/** * @param name The name * @return Return the first type parameter if it is present */ default Optional<Argument<?>> getTypeVariable(String name) { Argument<?> argument = getTypeVariables().get(name); return argument != null ? Optional.of(argument) : Optional.empty(); } }
/** * @return Return the first type parameter if it is present */ default Optional<Argument<?>> getFirstTypeVariable() { return getTypeVariables().values().stream().findFirst(); }