Commit b71bab28 authored by Phillip Webb's avatar Phillip Webb

Document deprecations of Archive.iterator()

Closes gh-21695
parent 6547ea56
......@@ -21,6 +21,10 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.jar.Manifest;
import org.springframework.boot.loader.Launcher;
......@@ -90,6 +94,36 @@ public interface Archive extends Iterable<Archive.Entry>, AutoCloseable {
@Override
Iterator<Entry> iterator();
/**
* Performs the given action for each element of the {@code Iterable} until all
* elements have been processed or the action throws an exception.
* @see Iterable#forEach
* @deprecated since 2.3.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
*/
@Deprecated
@Override
default void forEach(Consumer<? super Entry> action) {
Objects.requireNonNull(action);
for (Entry entry : this) {
action.accept(entry);
}
}
/**
* Creates a {@link Spliterator} over the elements described by this {@code Iterable}.
* @see Iterable#spliterator
* @deprecated since 2.3.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
*/
@Deprecated
@Override
default Spliterator<Entry> spliterator() {
return Spliterators.spliteratorUnknownSize(iterator(), 0);
}
/**
* Return if the archive is exploded (already unpacked).
* @return if the archive is exploded
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment