Class ReflectionSafeIterator<T>

java.lang.Object
net.shibboleth.utilities.java.support.collection.ReflectionSafeIterator<T>
Type Parameters:
T - iterator type
All Implemented Interfaces:
Iterator<T>

public class ReflectionSafeIterator<T> extends Object implements Iterator<T>
Wrapper class for delegating publically to Iterator implementations that may themselves be private.

This addresses bugs in Java that result from old implementations of collection classes that were never cleaned up to work properly in Java 17+ after access to JDK internals was clossed off.

Since:
8.2.0
  • Field Details

    • iter

      @Nonnull private final Iterator<T> iter
      Wrapped iterator.
  • Constructor Details

    • ReflectionSafeIterator

      public ReflectionSafeIterator(@Nonnull Iterator<T> i)
      Constructor.
      Parameters:
      i - iterator to wrap
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>