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

com.dahuatech.hutool.cache.impl.CacheValuesIterator Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.hutool.cache.impl;

import java.io.Serializable;
import java.util.Iterator;

/**
 * {@link com.dahuatech.hutool.cache.impl.AbstractCache} 的值迭代器.
 *
 * @author looly
 * @param  迭代对象类型
 */
public class CacheValuesIterator implements Iterator, Serializable {
  private static final long serialVersionUID = 1L;

  private final CacheObjIterator cacheObjIter;

  /**
   * 构造
   *
   * @param iterator 原{@link CacheObjIterator}
   * @param readLock 读锁
   */
  CacheValuesIterator(CacheObjIterator iterator) {
    this.cacheObjIter = iterator;
  }

  /** @return 是否有下一个值 */
  @Override
  public boolean hasNext() {
    return this.cacheObjIter.hasNext();
  }

  /** @return 下一个值 */
  @Override
  public V next() {
    return cacheObjIter.next().getValue();
  }

  /** 从缓存中移除没有过期的当前值,不支持此方法 */
  @Override
  public void remove() {
    cacheObjIter.remove();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy