/** * @param c Target collection. * @param it Iterable to fetch. * @return Modified target collection. */ @Deprecated public static <T, C extends Collection<T>> C addAll(C c, Iterable<? extends T> it) { if (it == null) return c; if (it instanceof Collection<?>) { c.addAll((Collection<? extends T>)it); return c; } return addAll(c, it.iterator()); }
/** * Creates grid node predicate evaluating on the given node IDs. * * @param nodeIds Collection of node IDs. * @return Grid node predicate evaluating on the given node IDs. * @see #idForNodeId(UUID) * @see #nodeIds(Collection) */ public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeIds(@Nullable final Collection<UUID> nodeIds) { if (isEmpty(nodeIds)) return alwaysFalse(); return new ContainsNodeIdsPredicate<>(nodeIds); }
/** * Gets predicate that returns {@code true} if its free variable is not * contained in given collection. * * @param c Collection to check for containment. * @param <T> Type of the free variable for the predicate and type of the * collection elements. * @return Predicate that returns {@code true} if its free variable is not * contained in given collection. */ public static <T> IgnitePredicate<T> notIn(@Nullable final Collection<? extends T> c) { return isEmpty(c) ? GridFunc.<T>alwaysTrue() : new NotContainsPredicate<>(c); }
/** * Flattens iterable-of-iterators and returns iterator over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input iterable of iterators. * @return Iterator over the elements of given iterators. */ public static <T> Iterator<T> flatIterators(@Nullable final Iterable<Iterator<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }
/** * 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; }
/** * 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); }
if (!eqNotOrdered((Collection)v1, (Collection)v2)) return false; if (!eqNotOrdered((Map)v1, (Map)v2)) return false; if (!eq(v1, v2)) return false;
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { return obj instanceof Collection && GridFunc.eqNotOrdered(this, (Collection)obj); } }
/** * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element * that is not contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is not contained in the passed in collection. */ public static <T> IgnitePredicate<T> notContains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysTrue() : new P1<T>() { @Override public boolean apply(T t) { return !c.contains(t); } }; }
/** * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element * that is contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. */ public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new P1<T>() { @Override public boolean apply(T t) { return c.contains(t); } }; }
/** * Waits until all passed futures will be executed. * * @param timeout Timeout for waiting ({@code 0} for forever). * @param futs Futures. If none provided - this method is no-op. * @throws IgniteCheckedException If any of the futures failed. */ @Deprecated public static <T> void awaitAll(long timeout, @Nullable Collection<IgniteInternalFuture<T>> futs) throws IgniteCheckedException { awaitAll(timeout, null, futs); }
/** {@inheritDoc} */ @Override public boolean apply(T t) { return !GridFunc.eq(t, target); }
/** * 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)); }
/** * Flattens iterable-of-iterables and returns iterable over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input collection of collections. * @param <T> Type of the inner collections. * @return Iterable over the elements of the inner collections. */ public static <T> GridIterator<T> flat(@Nullable final Iterable<? extends Iterable<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }
/** * 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; }
/** * 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); }
if (!eqNotOrdered((Collection)v1, (Collection)v2)) return false; if (!eqNotOrdered((Map)v1, (Map)v2)) return false; if (!eq(v1, v2)) return false;
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { return obj instanceof Collection && GridFunc.eqNotOrdered(this, (Collection<?>)obj); } }