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

org.infinispan.commons.util.IteratorAsCloseableIterator Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.commons.util;

import java.util.Iterator;

/**
 * This is a simple bridge class to change a plain {@link java.util.Iterator} into a
 * {@link org.infinispan.commons.util.CloseableIterator} where the close method does nothing
 *
 * @author wburns
 * @since 7.0
 */
public class IteratorAsCloseableIterator implements CloseableIterator {
   private final Iterator iterator;

   public IteratorAsCloseableIterator(Iterator iterator) {
      this.iterator = iterator;
   }

   @Override
   public void close() {
      // This does nothing
   }

   @Override
   public boolean hasNext() {
      return iterator.hasNext();
   }

   @Override
   public E next() {
      return iterator.next();
   }

   @Override
   public void remove() {
      iterator.remove();
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy