All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.cli.util.TransformingIterable Maven / Gradle / Ivy

package org.infinispan.cli.util;

import java.util.Iterator;
import java.util.Map;
import java.util.function.Function;

/**
 * @since 14.0
 **/
public class TransformingIterable implements Iterable {

   public static Function, String> SINGLETON_MAP_VALUE = m -> m.values().iterator().next();

   private final Iterable iterable;
   private final Function transformer;

   public TransformingIterable(Iterable iterable, Function transformer) {
      this.iterable = iterable;
      this.transformer = transformer;
   }

   @Override
   public Iterator iterator() {
      return new TransformingIterator<>(iterable.iterator(), transformer);
   }
}