@NullableDecl
  public static <T> T getOnlyElement(Iterator<? extends T> iterator, @NullableDecl T defaultValue) {
    return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue;
  }
@NullableDecl
  public static <T> T getOnlyElement(Iterator<? extends T> iterator, @NullableDecl T defaultValue) {
    return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue;
  }
@ NullableDecl public static < T > T getOnlyElement ( Iterator < ? extends T > iterator , @ NullableDecl T defaultValue ) { return iterator . hasNext ( ) ? getOnlyElement ( iterator ) : defaultValue ; }
Returns the single element contained in {@code iterator}, or {@code defaultValue} if the
iterator is empty.

@throws IllegalArgumentException if the iterator contains multiple elements. The state of the
iterator is unspecified.
Returns the single element contained in { @code iterator } or { @code defaultValue } if the iterator is empty .