/** * Concatenates multiple iterators as single one. * * @param iters Iterators. * @return Single iterator. */ @SuppressWarnings("unchecked") public static <T> Iterator<T> concat(Iterator<T> ... iters) { if (iters.length == 1) return iters[0]; return concat(asList(iters).iterator()); }
/** * Creates read-only set with given values. * * @param t Element (if {@code null}, then empty set is returned). * @param <T> Element's type. * @return Created set. */ @SuppressWarnings({"RedundantTypeArguments"}) @Deprecated public static <T> Set<T> asSet(@Nullable T... t) { if (t == null || t.length == 0) return Collections.<T>emptySet(); if (t.length == 1) return Collections.singleton(t[0]); return new GridLeanSet<>(asList(t)); }
/** * Transforms an array to read only collection using provided closure. * * @param c Initial array to transform. * @param f Closure to use for transformation. * @param <X> Type of the free variable for the closure and type of the array elements. * @param <Y> Type of the closure's return value. * @return Transformed read only collection. */ @Deprecated public static <X, Y> Collection<Y> transform(X[] c, IgniteClosure<? super X, Y> f) { A.notNull(c, "c", f, "f"); return viewReadOnly(asList(c), f); }
/** * Adds (copies) to given collection all elements in <tt>'from'</tt> array. * * @param to Collection to copy to. * @param from Array to copy from. * @param <T> Type of the free variable for the predicate and type of the collection elements. * @return Collection to copy to. */ @Deprecated public static <T> Collection<T> copy(Collection<T> to, T... from) { A.notNull(to, "to", from, "from"); copy(to, asList(from)); return to; }
/** * Calls given {@code side-effect only} closure over the each element of the provided array. * * @param c Array to call closure over. * @param f Side-effect only closure to call over the array. * @param p Optional set of predicates. Only if collection element evaluates * to {@code true} for given predicates the closure will be applied to it. * If no predicates provided - closure will be applied to all collection * elements. * @param <X> Type of the free variable for the closure and type of the array * elements. */ @Deprecated public static <X> void forEach(X[] c, IgniteInClosure<? super X> f, @Nullable IgnitePredicate<? super X>... p) { A.notNull(c, "c", f, "f"); F.<X>forEach(asList(c), f, p); }
/** * Concatenates multiple iterators as single one. * * @param iters Iterators. * @return Single iterator. */ @SuppressWarnings("unchecked") public static <T> Iterator<T> concat(Iterator<T> ... iters) { if (iters.length == 1) return iters[0]; return concat(asList(iters).iterator()); }
/** * Creates read-only set with given values. * * @param t Element (if {@code null}, then empty set is returned). * @param <T> Element's type. * @return Created set. */ @SuppressWarnings({"RedundantTypeArguments"}) @Deprecated public static <T> Set<T> asSet(@Nullable T... t) { if (t == null || t.length == 0) return Collections.<T>emptySet(); if (t.length == 1) return Collections.singleton(t[0]); return new GridLeanSet<>(asList(t)); }
/** * Adds (copies) to given collection all elements in <tt>'from'</tt> array. * * @param to Collection to copy to. * @param from Array to copy from. * @param <T> Type of the free variable for the predicate and type of the collection elements. * @return Collection to copy to. */ @Deprecated public static <T> Collection<T> copy(Collection<T> to, T... from) { A.notNull(to, "to", from, "from"); copy(to, asList(from)); return to; }
/** * Calls given {@code side-effect only} closure over the each element of the provided array. * * @param c Array to call closure over. * @param f Side-effect only closure to call over the array. * @param p Optional set of predicates. Only if collection element evaluates * to {@code true} for given predicates the closure will be applied to it. * If no predicates provided - closure will be applied to all collection * elements. * @param <X> Type of the free variable for the closure and type of the array * elements. */ @SuppressWarnings("RedundantTypeArguments") @Deprecated public static <X> void forEach(X[] c, IgniteInClosure<? super X> f, @Nullable IgnitePredicate<? super X>... p) { A.notNull(c, "c", f, "f"); F.<X>forEach(asList(c), f, p); }
/** * Transforms an array to read only collection using provided closure. * * @param c Initial array to transform. * @param f Closure to use for transformation. * @param <X> Type of the free variable for the closure and type of the array elements. * @param <Y> Type of the closure's return value. * @return Transformed read only collection. */ @Deprecated public static <X, Y> Collection<Y> transform(X[] c, IgniteClosure<? super X, Y> f) { A.notNull(c, "c", f, "f"); return viewReadOnly(asList(c), f); }