code: public static <T> int compare(IntStream s1, IntStream s2, IntBinaryOperator comp)
      {
          PrimitiveIterator.OfInt os1 = s1.iterator();
          PrimitiveIterator.OfInt os2 = s2.iterator();
          while (os1.hasNext() && os2.hasNext())
          {
              int n1 = os1.next();
              int n2 = os2.next();
              int c;
              if (comp == null)
              {
                  c = n1 - n2;
              }
              else
              {
                  c = comp.applyAsInt(n1, n2);
              }
              if (c != 0)
              {
                  return c;
              }
          }
          boolean hn1 = os1.hasNext();
          boolean hn2 = os2.hasNext();
          if (hn1 == hn2)
          {
              return 0;
          }
          if (hn1)
          {
              return 1;
          }
          else
          {
              return -1;
          }
      }
docs: Compares two streams using given comparator
  @param <T>
  @param s1
  @param s2
  @param comp
  @return