@Test public void start() throws Exception { System.out.println(z.start()); System.out.println(Zipper.of(LazySeq.empty(),1,LazySeq.of(2,3,5,10,20,30))); assertThat(z.start(),equalTo(Zipper.of(LazySeq.empty(),1,LazySeq.of(2,3,5,10,20,30)))); }
public Zipper<T> start() { Option<Zipper<T>> result = Option.some(this); Option<Zipper<T>> next = result; while(next.isPresent()){ next = result.flatMap(p->p.previous()); if(next.isPresent()) result = next; } return result.orElse(this); }
Zipper implements Iterable<T>,
                                    Higher<zipper,T> { public Zipper<T> start() { Option<Zipper<T>> result = Option.some(this); Option<Zipper<T>> next = result; while(next.isPresent()){ next = result.flatMap(p->p.previous()); if(next.isPresent()) result = next; } return result.orElse(this); } }
Zipper implements Iterable<T>,
                                    Higher<zipper,T> { public Zipper<T> start() { Option<Zipper<T>> result = Option.some(this); Option<Zipper<T>> next = result; while(next.isPresent()){ next = result.flatMap(p->p.previous()); if(next.isPresent()) result = next; } return result.orElse(this); }  }
Zipper implements Iterable<T>,
                                    Higher<zipper,T> { public Zipper<T> start() { Option<Zipper<T>> result = Option.some(this); Option<Zipper<T>> next = result; while(next.isPresent()){ next = result.flatMap(p->p.previous()); if(next.isPresent()) result = next; } return result.orElse(this); }  static Zipper<T> of(ImmutableList<T> left, T value, ImmutableList<T> right); static Zipper of(ReactiveSeq<T> left, T value, ReactiveSeq<T> right); boolean isStart(); boolean isEnd(); Zipper<R> map(Function<? super T, ? extends R> fn); Zipper<R> zip(Zipper<T> zipper, BiFunction<? super T, ? super T, ? extends R> fn); Zipper<Tuple2<T,T>> zip(Zipper<T> zipper); Zipper<T> start(); Zipper<T> end(); int index(); Option<Zipper<T>> position(int index); Option<Zipper<T>> next(); Zipper<T> next(Zipper<T> alt); Zipper<T> previous(Zipper<T> alt); Zipper<T> cycleNext(); Zipper<T> cyclePrevious(); Option<Zipper<T>> previous(); Zipper<T> left(T value); Zipper<T> right(T value); Zipper<T> deleteAllLeftAndRight(); Option<Zipper<T>> deleteLeft(); Option<Zipper<T>> deleteRight(); Zipper<T> filterLeft(Predicate<? super T> predicate); Zipper<T> filterRight(Predicate<? super T> predicate); Tuple3<ImmutableList<T>,T, ImmutableList<T>> split(); ImmutableList<T> list(); ReactiveSeq<T> stream(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override Iterator<T> iterator(); }
Zipper implements Iterable<T>,
                                    Higher<zipper,T> { public Zipper<T> start() { Option<Zipper<T>> result = Option.some(this); Option<Zipper<T>> next = result; while(next.isPresent()){ next = result.flatMap(p->p.previous()); if(next.isPresent()) result = next; } return result.orElse(this); }  static Zipper<T> of(ImmutableList<T> left, T value, ImmutableList<T> right); static Zipper of(ReactiveSeq<T> left, T value, ReactiveSeq<T> right); boolean isStart(); boolean isEnd(); Zipper<R> map(Function<? super T, ? extends R> fn); Zipper<R> zip(Zipper<T> zipper, BiFunction<? super T, ? super T, ? extends R> fn); Zipper<Tuple2<T,T>> zip(Zipper<T> zipper); Zipper<T> start(); Zipper<T> end(); int index(); Option<Zipper<T>> position(int index); Option<Zipper<T>> next(); Zipper<T> next(Zipper<T> alt); Zipper<T> previous(Zipper<T> alt); Zipper<T> cycleNext(); Zipper<T> cyclePrevious(); Option<Zipper<T>> previous(); Zipper<T> left(T value); Zipper<T> right(T value); Zipper<T> deleteAllLeftAndRight(); Option<Zipper<T>> deleteLeft(); Option<Zipper<T>> deleteRight(); Zipper<T> filterLeft(Predicate<? super T> predicate); Zipper<T> filterRight(Predicate<? super T> predicate); Tuple3<ImmutableList<T>,T, ImmutableList<T>> split(); ImmutableList<T> list(); ReactiveSeq<T> stream(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override Iterator<T> iterator();  }