@UnstableApi
    default <T> CompletableFuture<List<T>> collect(
            Function<? super BodyPart, CompletableFuture<? extends T>> function) {
        return collect(function, EMPTY_OPTIONS);
    }
Collects the elements published by this {@link Multipart}.
The returned {@link CompletableFuture} will be notified when the elements are fully consumed.

<p>Note that if this {@link Multipart} was subscribed by other {@link Subscriber} already,
the returned {@link CompletableFuture} will be completed with an {@link IllegalStateException}.

<p>For example:
<pre>{@code
Path tempDir = ...;
CompletableFuture<List<Object>> collect =
        Multipart.of(request)
                 .collect(bodyPart -> {
                     if (bodyPart.filename() != null) {
                         final Path path = tempDir.resolve(bodyPart.name());
                         return bodyPart.writeTo(path).thenApply(ignore -> path);
                     }
                     return bodyPart.aggregate().thenApply(AggregatedHttpObject::contentUtf8);
                 });
}</pre>

<p>Note that a {@link MimeParsingException} or another exception can be raised while collecting
so handle it properly.

@param function A {@link Function} that processes the {@link BodyPart} and returns a future that will
                complete with the process result. The {@link Function} must consume the {@link BodyPart}.
                And If not, collect method will stop processing next {@link BodyPart}.
core/src/main/java/com/linecorp/armeria/common/multipart/Multipart.java