Package net.shibboleth.shared.collection

# Class ReflectionSafeIterator<T>

java.lang.Object
net.shibboleth.shared.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 Summary

Fields
Modifier and Type
Field
Description
`private final Iterator<T>`
`iter`
Wrapped iterator.

## Constructor Summary

Constructors
Constructor
Description
`ReflectionSafeIterator(Iterator<T> i)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`hasNext()`
`T`
`next()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Iterator

`forEachRemaining, remove`

## 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>`