Skip to content

Commit

Permalink
Document the JDK 9+ alternative to Iterators#forEnumeration
Browse files Browse the repository at this point in the history
Fixes #3382

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272441426
  • Loading branch information
Stephan202 authored and cpovirk committed Oct 2, 2019
1 parent e2362de commit e432be5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions android/guava/src/com/google/common/collect/Iterators.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,9 @@ public T next() {
* <p>This method has no equivalent in {@link Iterables} because viewing an {@code Enumeration} as
* an {@code Iterable} is impossible. However, the contents can be <i>copied</i> into a collection
* using {@link Collections#list}.
*
* <p><b>Java 9 users:</b> use {@code enumeration.asIterator()} instead, unless it is important to
* return an {@code UnmodifiableIterator} instead of a plain {@code Iterator}.
*/
public static <T> UnmodifiableIterator<T> forEnumeration(final Enumeration<T> enumeration) {
checkNotNull(enumeration);
Expand Down
3 changes: 3 additions & 0 deletions guava/src/com/google/common/collect/Iterators.java
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,9 @@ public T next() {
* <p>This method has no equivalent in {@link Iterables} because viewing an {@code Enumeration} as
* an {@code Iterable} is impossible. However, the contents can be <i>copied</i> into a collection
* using {@link Collections#list}.
*
* <p><b>Java 9 users:</b> use {@code enumeration.asIterator()} instead, unless it is important to
* return an {@code UnmodifiableIterator} instead of a plain {@code Iterator}.
*/
public static <T> UnmodifiableIterator<T> forEnumeration(final Enumeration<T> enumeration) {
checkNotNull(enumeration);
Expand Down

0 comments on commit e432be5

Please sign in to comment.