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

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

本文整理了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

  1. /**
  2. * Transforms an array of Ts in a single object having the same methods of a single instance of T.
  3. * That allows to invoke a method on each T in the array with a single strong typed method call.
  4. * @param <T> The type of the items in the array
  5. * @param array The array to be transformed
  6. * @return An object that proxies all the item in the array
  7. */
  8. public static <T> T forEach(T... array) {
  9. return forEach((Class<T>)array[0].getClass(), array);
  10. }

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

  1. /**
  2. * Add the list of poll options to this poll.
  3. *
  4. * @param options the list of poll options to this poll
  5. */
  6. public void addPollOptions(List<PollItem> options) {
  7. pollItems.addAll(options);
  8. forEach(options).setPoll(this);
  9. }

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

  1. /**
  2. * Transforms this iterable in a single object having the same methods of a single object in this iterable.
  3. * That allows to invoke a method on each T in the collection with a single strong typed method call.
  4. * The actual class of T is inferred from the class of the first iterable's item, but you can
  5. * specify a particular class by using the overloaded method.
  6. * @return An object that proxies all the item in the iterator or null if the iterator is null or empty
  7. */
  8. public T forEach() {
  9. return Lambda.forEach(getInnerIterator());
  10. }

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

  1. @Override
  2. public void deleteAll() {
  3. forEach(shardedJedis.getAllShards()).flushAll();
  4. }

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

  1. /**
  2. * Transforms the subset of objects in this iterable that match the given Mathcer
  3. * in a single object having the same methods of a single object in this iterable.
  4. * That allows to invoke a method on each T in the collection with a single strong typed method call.
  5. * The actual class of T is inferred from the class of the first iterable's item, but you can
  6. * specify a particular class by using the overloaded method.
  7. * @return An object that proxies all the item in the iterator or null if the iterator is null or empty
  8. */
  9. public T forEach(Matcher<?> matcher) {
  10. return Lambda.forEach((List<T>)Lambda.select(getInner(), matcher));
  11. }

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

  1. @Override
  2. public void deleteAll() {
  3. forEach(shardedJedis.getAllShards()).flushAll();
  4. }

相关文章