@SuppressWarnings("unchecked")
    public static @NonNull Iterable<@NonNull Suggestion> mapCompleted(final @NonNull Object input) {
        final List<?> suggestions;
        if (input instanceof List) {
            suggestions = (List<?>) input;
        } else if (input instanceof Collection) {
            suggestions = new ArrayList<>((Collection<?>) input);
        } else if (input instanceof Iterable) {
            suggestions = new ArrayList<>();
            for (final Object suggestion : ((Iterable<?>) input)) {
                ((List<Object>) suggestions).add(suggestion);
            }
        } else if (input instanceof Stream) {
            suggestions = ((Stream<?>) input).collect(Collectors.toList());
        } else {
            throw new IllegalArgumentException(
                    String.format("Cannot handle suggestion input of type %s",
                            input.getClass().getName())
            );
        }

        if (suggestions.isEmpty()) {
            return Collections.emptyList();
        }

        final Object suggestion = suggestions.get(0);
        if (suggestion instanceof Suggestion) {
            return (List<Suggestion>) suggestions;
        } else if (suggestion instanceof String) {
            return suggestions.stream().map(Object::toString).map(Suggestion::suggestion).collect(Collectors.toList());
        } else {
            throw new IllegalArgumentException(
                    String.format("Cannot handle suggestions of type: %s",
                            suggestion.getClass().getName())
            );
        }
    }
Maps the input to a list of suggestions. The input must be a stream, or an iterable.

@param input the input
@return the suggestions
cloud-annotations/src/main/java/org/incendo/cloud/annotations/suggestion/MethodSuggestionProvider.java