docs: @CanIgnoreReturnValue // TODO(kak): Consider removing this?
    public static <T> T getOnlyElement(Iterator<T> iterator) {
      T first = iterator.next();
      if (!iterator.hasNext()) {
        return first;
      }
  
      StringBuilder sb = new StringBuilder().append("expected one element but was: <").append(first);
      for (int i = 0; i < 4 && iterator.hasNext(); i++) {
        sb.append(", ").append(iterator.next());
      }
      if (iterator.hasNext()) {
        sb.append(", ...");
      }
      sb.append('>');
  
      throw new IllegalArgumentException(sb.toString());
    }