code: public static <T> CloseableSpliterator<T> spliterator(Spliterator<T> spliterator) {
        if (spliterator instanceof CloseableSpliterator) {
           return (CloseableSpliterator<T>) spliterator;
        }
        return new SpliteratorAsCloseableSpliterator<>(spliterator);
     }
docs: Creates a closeable spliterator from the given spliterator that does nothing when close is called.
  @param spliterator The spliterator to wrap to allow it to become a closeable spliterator.
  @param <T> The type of the spliterators
  @return A spliterator that does nothing when closed