@Override public final <T1> T1[] toArray(T1[] a) { return emptyJavaList().toArray(a); }
/** * Returns an empty immutable list * * @param <T> the type of the list element * @return the empty list */ public static <T> List<T> list() { return Nil.list(); }
@Override public C.ReversibleSequence<T> reverse() throws UnsupportedOperationException { if (isEmpty()) { return Nil.rseq(); } return ReversedRSeq.of(this); }
/** * Create an empty immutable set * @param <T> the generic type * @return the empty set */ public static <T> Set<T> Set() { return Nil.set(); }
@Override public C.Sequence<T> head(int n) { if (n < 0) { throw new UnsupportedOperationException(); } if (n == 0) { return Nil.seq(); } return of(Iterators.filterIndex(itr_, N.F.lt(n))); }
@Override public <R> C.Sequence<R> map($.Function<? super T, ? extends R> mapper) { return singleton(); }
@Override public C.Range<ELEMENT> tail() throws UnsupportedOperationException { ELEMENT from = next.apply(from()); if ($.eq(from, to)) { return Nil.range(); } return of(next.apply(from()), to); }
/** * Create an empty immutable set * @param <T> the generic type * @return the empty set */ public static <T> Set<T> Set() { return Nil.set(); }
@Override public C.Sequence<T> head(int n) { if (n < 0) { throw new UnsupportedOperationException(); } if (n == 0) { return Nil.seq(); } return of(Iterators.filterIndex(itr_, N.F.lt(n))); }
@Override public <R> C.Sequence<R> flatMap($.Function<? super T, ? extends Iterable<? extends R>> mapper) { return singleton(); }
@Override public C.Range<ELEMENT> tail() throws UnsupportedOperationException { ELEMENT from = next.apply(from()); if ($.eq(from, to)) { return Nil.range(); } return of(next.apply(from()), to); }
/** * Returns an empty immutable list * * @param <T> the type of the list element * @return the empty list */ public static <T> List<T> list() { return Nil.list(); }
/** * This method is deprecated. Please use {@link #Set()} instead */ @Deprecated public static <T> Set<T> set() { return Nil.set(); }
@Override public C.ReversibleSequence<T> reverse() throws UnsupportedOperationException { if (isEmpty()) { return Nil.rseq(); } return ReversedRSeq.of(this); }
@Override public C.Sequence<T> head(int n) { if (n == 0) { return Nil.seq(); } else if (n < 0) { if (isLimited()) { return drop(size() + n); } else { throw new UnsupportedOperationException(); } } else { if (isLimited() && n >= size()) { return this; } return IndexFilteredSeq.of(this, $.F.lessThan(n)); } }
@Override public <R> C.Sequence<R> map($.Function<? super T, ? extends R> mapper) { return singleton(); }
@Override public final <T1> T1[] toArray(T1[] a) { return emptyJavaList().toArray(a); }
@Override public C.List<T> asList() { return list(); }
/** * This method is deprecated. Please use {@link #Set()} instead */ @Deprecated public static <T> Set<T> set() { return Nil.set(); }
@Override public C.ReversibleSequence<T> drop(int n) throws IllegalArgumentException { int sz = size(); if (n < 0) { n = -n; if (n >= sz) return Nil.rseq(); return take(sz - n); } if (n == 0) { return this; } return IndexFilteredRSeq.of(this, $.F.gte(n)); }