示例#1
0
 /**
  * Returns a stream of the elements of this vector.
  *
  * @return a stream of the elements of this vector.
  */
 public Stream<A> toStream() {
   return Stream.cons(
       _1(),
       new P1<Stream<A>>() {
         public Stream<A> _1() {
           return Stream.single(_2());
         }
       });
 }
示例#2
0
 /**
  * Returns a stream of the elements of this vector.
  *
  * @return a stream of the elements of this vector.
  */
 public Stream<A> toStream() {
   return Stream.cons(
       head._1(),
       new P1<Stream<A>>() {
         public Stream<A> _1() {
           return tail.toStream();
         }
       });
 }
示例#3
0
 /**
  * Splits this lazy string by characters matching the given predicate.
  *
  * @param p A predicate that matches characters to be considered delimiters.
  * @return A stream of the substrings in this lazy string, when separated by the given predicate.
  */
 public Stream<LazyString> split(final F<Character, Boolean> p) {
   final Stream<Character> findIt = s.dropWhile(p);
   final P2<Stream<Character>, Stream<Character>> ws = findIt.split(p);
   return findIt.isEmpty()
       ? Stream.<LazyString>nil()
       : Stream.cons(
           fromStream(ws._1()),
           new P1<Stream<LazyString>>() {
             public Stream<LazyString> _1() {
               return fromStream(ws._2()).split(p);
             }
           });
 }