ch.lambdaj.Lambda.forEach()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中ch.lambdaj.Lambda.forEach()方法的一些代码示例,展示了Lambda.forEach()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.forEach()方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:forEach

Lambda.forEach介绍

[英]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.
[中]转换单个对象中的Ts数组,该对象具有与单个T实例相同的方法。这允许使用单个强类型方法调用对数组中每个T调用方法。

代码示例

代码示例来源:origin: mariofusco/lambdaj

/**
 * 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);
}

代码示例来源:origin: jtalks-org/jcommune

/**
 * 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);
}

代码示例来源:origin: mariofusco/lambdaj

/**
 * 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());
}

代码示例来源:origin: lordofthejars/nosql-unit

@Override
public void deleteAll() {
  forEach(shardedJedis.getAllShards()).flushAll();
}

代码示例来源:origin: mariofusco/lambdaj

/**
 * 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));
}

代码示例来源:origin: com.lordofthejars/nosqlunit-redis

@Override
public void deleteAll() {
  forEach(shardedJedis.getAllShards()).flushAll();
}

相关文章