public Application(final List<RegisterEntry> entries) { this.entries = Seq.fromIterable(entries); }
public ServerRunner(ApplicationRegister register, List<ServerApplication> apps, CompletableFuture end) { this.apps = Seq.fromIterable(apps); this.register = Optional.of(register); this.end = end; } public ServerRunner(List<ServerApplication> apps, CompletableFuture end) {
public ServerRunner(List<ServerApplication> apps, CompletableFuture end) { this.apps = Seq.fromIterable(apps); this.register = Optional.empty(); this.end = end; }
public AllData(ServerData serverData, List<FilterData> filterDataList, List<ServletData> servletDataList, List<ServletContextListener> servletContextListeners, List<ServletRequestListener> servletRequestListeners ) { this.servletContextListeners = Seq.fromIterable(UsefulStaticMethods.either(servletContextListeners, new ArrayList<ServletContextListener>())); this.servletRequestListeners = Seq.fromIterable(UsefulStaticMethods.either(servletRequestListeners, new ArrayList<ServletRequestListener>())); this.filterDataList = Seq.fromIterable(UsefulStaticMethods.either(filterDataList, new ArrayList<FilterData>())); this.servletDataList = Seq.fromIterable(UsefulStaticMethods.either(servletDataList, new ArrayList<ServletData>())); this.serverData = serverData; } public AllData(ServerData serverData, PersistentList<FilterData> filterDataList,
public AllData(ServerData serverData, PersistentList<FilterData> filterDataList, PersistentList<ServletData> servletDataList, PersistentList<ServletContextListener> servletContextListeners, PersistentList<ServletRequestListener> servletRequestListeners ) { this.servletContextListeners = Seq.fromIterable(UsefulStaticMethods.either(servletContextListeners, new ArrayList<ServletContextListener>())); this.servletRequestListeners = Seq.fromIterable(UsefulStaticMethods.either(servletRequestListeners, new ArrayList<ServletRequestListener>())); this.filterDataList = Seq.fromIterable(UsefulStaticMethods.either(filterDataList, new ArrayList<FilterData>())); this.servletDataList = Seq.fromIterable(UsefulStaticMethods.either(servletDataList, new ArrayList<ServletData>())); this.serverData = serverData; }
public Seq<T> seq(){ return Seq.fromIterable(iterable); } public Vector<T> vector(){
@Override public Seq<T> insertAt(int i, Iterable<? extends T> list) { return fromIterable((Iterable<T>)list); }
@Override default<R> Seq<R> unitIterable(Iterable<R> it){ if(it instanceof Seq){ return (Seq<R>)it; } return fromIterable(it); } default Seq<T> plusAll(Iterable<? extends T> t){
default Seq<T> seq(){ return Seq.fromIterable(this); } default NonEmptyList<T> nonEmptyList(Supplier<T> s){
@Override public Seq<T> plusAll(Iterable<? extends T> t) { return fromIterable((Iterable<T>)t); }
public static <V> Predicate<Iterable<? super V>> eqvIterable(final Iterable<? super V> iterable) { return test -> test == null ? iterable == null ? true : Seq.fromIterable(iterable) .isEmpty() : Seq.fromIterable(test) .equals(Seq.fromIterable(iterable)); }
@Override default Seq<T> tailOrElse(ImmutableList<T> tail) { ImmutableList<T> list = ImmutableList.super.tailOrElse(tail); return Seq.fromIterable(list); }
public static final <A> Seq<Iterator<A>> toBufferingCopier(final Iterator<A> iterator, final int copies, Supplier<Deque<A>> bufferSupplier) { final List<Iterator<A>> result = new ArrayList<>(); ArrayList<Deque<A>> localBuffers = new ArrayList<>(copies); for(int i=0;i<copies;i++) { final Deque<A> buffer = bufferSupplier.get(); localBuffers.add(buffer); result.add(new CopyingIterator(localBuffers, iterator, buffer)); } return Seq.fromIterable(result); }
public static final <A> Seq<Iterator<A>> toBufferingCopier(final Iterator<A> iterator, final int copies) { final List<Iterator<A>> result = new ArrayList<>(); ArrayList<Deque<A>> localBuffers = new ArrayList<>(copies); for(int i=0;i<copies;i++) { final Deque<A> buffer = new LinkedList<A>(); localBuffers.add(buffer); result.add(new CopyingIterator(localBuffers, iterator, buffer)); } return Seq.fromIterable(result); } public static final <A> Seq<Iterator<A>> toBufferingCopier(final Iterator<A> iterator, final int copies, Supplier<Deque<A>> bufferSupplier) {
static <E> Enumeration<E> enumsList(List<E> seq){ return new EnumerationByIndexed<E>(Seq.fromIterable(seq)); } @AllArgsConstructor
public final static <T> Stream<Seq<T>> groupedByTime(final Stream<T> stream, final long time, final TimeUnit t) { return StreamSupport.stream(new GroupedByTimeSpliterator(stream.spliterator(),()->Seq.fromIterable(new ArrayList<>()), Function.identity(),time,t),stream.isParallel()); } @Deprecated
public static <T,R> Managed<Seq<R>> traverse(Iterable<T> stream,Function<? super T,Managed<? extends R>> fn) { Seq<Managed<R>> s = Seq.fromIterable(stream).map(fn.andThen(Managed::narrow)); return sequence(s); }
/** * Group a Stream by size and time constraints * * @see ReactiveSeq#groupedBySizeAndTime(int, long, TimeUnit) * * @param stream Stream to group * @param size Max group size * @param time Max group time * @param t Time unit for max group time * @return Stream grouped by time and size */ public final static <T> Stream<Seq<T>> groupedBySizeAndTime(final Stream<T> stream, final int size, final long time, final TimeUnit t) { return StreamSupport.stream(new GroupedByTimeAndSizeSpliterator(stream.spliterator(),()->Seq.fromIterable(new ArrayList<>(size)), Function.identity(),size,time,t),stream.isParallel()); }
default Seq<T> appendAll(Iterable<? extends T> it){ Seq<T> value = narrow(fromIterable(it)); return value.prependAll(this); } default Seq<T> prepend(T value){
public static <T,R> Managed<Seq<R>> traverse(Function<? super T,? extends R> fn, Iterable<Managed<T>> stream) { Seq<Managed<R>> s = Seq.fromIterable(stream) .map(j->j.map(fn)); return sequence(s); } public static <T> Managed<T> narrow(Managed<? extends T> broad){