@Deprecated(since = "3.0.1", forRemoval = true)
    @SuppressWarnings("InlineMeSuggester")
    public static <T> Collector<T, ?, Optional<T>> toOptional() {
        return OptionalCollectors.toOptional();
    }
Returns a {@code Collector} that accumulates 0 or 1 input elements into an {@code Optional<T>}.
The returned collector will throw {@code IllegalStateException} whenever 2 or more elements
are present in a stream.

@param <T> the collected type
@return a {@code Collector} which collects 0 or 1 input elements into an {@code Optional<T>}.
@deprecated Use {@link OptionalCollectors#toOptional()} instead.
core/src/main/java/org/jdbi/v3/core/collector/BuiltInCollectorFactory.java