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

org.infinispan.util.MappedCacheStream Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.util;

import java.util.Set;

import org.infinispan.CacheStream;
import org.infinispan.commons.util.InjectiveFunction;

/**
 * CacheStream that allows for mapping the filtered keys to different keys. Note that the function provided
 * must be a {@link InjectiveFunction} guaranteeing that keys are distinct when mapped.
 * @author wburns
 * @since 9.2
 */
class MappedCacheStream extends AbstractDelegatingCacheStream {
   private final InjectiveFunction keyMapper;
   MappedCacheStream(CacheStream stream, InjectiveFunction keyMapper) {
      super(stream);
      this.keyMapper = keyMapper;
   }

   @Override
   public AbstractDelegatingCacheStream filterKeys(Set keys) {
      return super.filterKeys(keys != null ? new SetMapper<>(keys, keyMapper) : null);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy