/** * Transforms an array of Ts in a single object having the same methods of a single instance of T. * That allows to invoke a method on each T in the array with a single strong typed method call. * @param <T> The type of the items in the array * @param array The array to be transformed * @return An object that proxies all the item in the array */ public static <T> T forEach(T... array) { return forEach((Class<T>)array[0].getClass(), array); }
/** * Add the list of poll options to this poll. * * @param options the list of poll options to this poll */ public void addPollOptions(List<PollItem> options) { pollItems.addAll(options); forEach(options).setPoll(this); }
/** * Transforms this iterable in a single object having the same methods of a single object in this iterable. * That allows to invoke a method on each T in the collection with a single strong typed method call. * The actual class of T is inferred from the class of the first iterable's item, but you can * specify a particular class by using the overloaded method. * @return An object that proxies all the item in the iterator or null if the iterator is null or empty */ public T forEach() { return Lambda.forEach(getInnerIterator()); }
@Override public void deleteAll() { forEach(shardedJedis.getAllShards()).flushAll(); }
/** * Transforms the subset of objects in this iterable that match the given Mathcer * in a single object having the same methods of a single object in this iterable. * That allows to invoke a method on each T in the collection with a single strong typed method call. * The actual class of T is inferred from the class of the first iterable's item, but you can * specify a particular class by using the overloaded method. * @return An object that proxies all the item in the iterator or null if the iterator is null or empty */ public T forEach(Matcher<?> matcher) { return Lambda.forEach((List<T>)Lambda.select(getInner(), matcher)); }
@Override public void deleteAll() { forEach(shardedJedis.getAllShards()).flushAll(); }