com.dahuatech.hutool.cache.impl.CacheValuesIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-common Show documentation
Show all versions of java-sdk-common Show documentation
Dahua ICC Open API SDK for Java
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, V> cacheObjIter;
/**
* 构造
*
* @param iterator 原{@link CacheObjIterator}
* @param readLock 读锁
*/
CacheValuesIterator(CacheObjIterator, V> 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();
}
}