static <T> T unwrapOtherMonadTypes(Comprehender<T> comp,Object apply){ if(apply instanceof Collection){ return (T)((Collection)apply).stream(); } if(apply instanceof Stream){ return (T)((Stream)apply); } return Comprehender.unwrapOtherMonadTypes(comp,apply); }
static <T> T unwrapOtherMonadTypes(Comprehender<T> comp,Object apply){ if(apply instanceof Collection){ return (T)((Collection)apply).stream(); } if(apply instanceof Iterable){ return (T)StreamSupport.stream(((Iterable)apply).spliterator(), false); } return Comprehender.unwrapOtherMonadTypes(comp,apply); }
/** * Wrapper around flatMap * * @param t Monadic type being wrapped * @param fn JDK Function to wrap * @return Result of call to <pre>{@code t.flatMap( i -> fn.apply(i)); }</pre> */ default Object executeflatMap(T t, Function fn){ return flatMap(t,input -> unwrapOtherMonadTypes(this,fn.apply(input))); }
/** * Wrapper around flatMap * * @param t Monadic type being wrapped * @param fn JDK Function to wrap * @return Result of call to <pre>{@code t.flatMap( i -> fn.apply(i)); }</pre> */ default Object executeflatMap(T t, Function fn){ return flatMap(t,input -> unwrapOtherMonadTypes(this,fn.apply(input))); }
/** * Wrapper around flatMap * * @param t Monadic type being wrapped * @param fn JDK Function to wrap * @return Result of call to <pre>{@code t.flatMap( i -> fn.apply(i)); }</pre> */ default Object executeflatMap(T t, Function fn){ return flatMap(t,input -> unwrapOtherMonadTypes(this,fn.apply(input))); }
public static <T> T unwrapOtherMonadTypes(Comprehender<T> comp,Object apply){ if(apply instanceof Collection){ return (T)((Collection)apply).stream(); } if(apply instanceof Iterable){ return (T)StreamSupport.stream(((Iterable)apply).spliterator(), false); } if(apply instanceof BaseStream){ return (T)StreamSupport.stream(Spliterators.spliteratorUnknownSize(((BaseStream)apply).iterator(), Spliterator.ORDERED), false); } return Comprehender.unwrapOtherMonadTypes(comp,apply); }
public static <T> T unwrapOtherMonadTypes(Comprehender<T> comp,Object apply){ if(apply instanceof Collection){ return (T)((Collection)apply).stream(); } if(apply instanceof Iterable){ return (T)StreamSupport.stream(((Iterable)apply).spliterator(), false); } if(apply instanceof BaseStream){ return (T)StreamSupport.stream(Spliterators.spliteratorUnknownSize(((BaseStream)apply).iterator(), Spliterator.ORDERED), false); } return Comprehender.unwrapOtherMonadTypes(comp,apply); }
static LazySeq unwrapOtherMonadTypes(Comprehender<LazySeq> comp,Object apply){ if(apply instanceof LazySeq) return (LazySeq)apply; if(apply instanceof Collection){ return LazySeq.of((Collection)apply); } if (apply instanceof Stream) { return LazySeq.of( ((Stream)apply).iterator()); } return Comprehender.unwrapOtherMonadTypes(comp,apply); } }
false); Object o = Comprehender.unwrapOtherMonadTypes(comp,apply); if(o instanceof Collection){ return ((Collection)o).stream();
false); Object o = Comprehender.unwrapOtherMonadTypes(comp,apply); if(o instanceof Collection){ return ((Collection)o).stream();
false); Object o = Comprehender.unwrapOtherMonadTypes(comp,apply); if(o instanceof Collection){ return ((Collection)o).stream();
false); Object o = Comprehender.unwrapOtherMonadTypes(comp,apply); if(o instanceof Collection){ return ((Collection)o).stream();
static <T> T unwrapOtherMonadTypes(Comprehender<T> comp,Object apply){ if(apply instanceof LazySeq){ return (T)StreamUtils.stream(((LazySeq)apply).iterator()); } if(apply instanceof Iterable){ return (T)StreamUtils.stream(((Iterable)apply)); } if(apply instanceof Collection){ return (T)((Collection)apply).stream(); } return Comprehender.unwrapOtherMonadTypes(comp,apply); }