code: public static <E> Stream<Map.Entry<E, E>> crossProductOrdered(Stream<E> stream, Comparator<E> comparator) {
          Objects.requireNonNull(stream);
          Objects.requireNonNull(comparator);
  
          CrossProductOrderedSpliterator<E> spliterator =
                  CrossProductOrderedSpliterator.ordered(stream.spliterator(), comparator);
  
          return StreamSupport.stream(spliterator, stream.isParallel()).onClose(stream::close);
      }
docs: <p>Generates a stream of <code>Map.Entry&lt;E, E&gt;</code> elements with all the cartesian product of the
  elements of the provided stream with itself, in which the entries are such that the key is
  strictly lesser than the value, using the provided comparator.</p>
  <p>For a stream <code>{a, b, c}</code>, a stream with the following elements is created:
  <code>{(a, b), (a, c), (b, c)}</code>, where
  <code>(a, b)</code> is the <code>Map.Entry</code> with key <code>a</code> and value <code>b</code>.</p>
  <p>A <code>NullPointerException</code> will be thrown if the provided stream or comparator is null.</p>
  
  @param stream     the processed stream
  @param comparator the comparator or the elements of the provided stream
  @param <E>        the type of the provided stream
  @return a stream of the cartesian product