Exemplo n.º 1
0
 public static void main(final String[] a) {
   final Stream<Integer> tdl =
       iterate(flip(subtract).f(1), 999).takeWhile(intOrd.isGreaterThan(99));
   intShow.println(
       tdl.tails()
           .bind(tdl.zipWith(multiply))
           .filter(
               new F<Integer, Boolean>() {
                 public Boolean f(final Integer i) {
                   final Stream<Character> s = intShow.show(i);
                   return streamEqual(charEqual).eq(s.reverse().take(3), s.take(3));
                 }
               })
           .foldLeft1(intOrd.max));
 }
Exemplo n.º 2
0
 /**
  * Returns true if the given lazy string is a substring of this lazy string.
  *
  * @param cs A substring to find in this lazy string.
  * @return True if the given string is a substring of this string, otherwise False.
  */
 public boolean contains(final LazyString cs) {
   return or(s.tails().map(compose(startsWith().f(cs), fromStream)));
 }