com.softicar.platform.common.container.map.weak.WeakIntHashMapIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.map.weak;
import com.softicar.platform.common.core.annotations.Nullable;
import java.util.Iterator;
class WeakIntHashMapIterator<@Nullable V> implements Iterator {
private final Iterator> iterator;
private V value;
public WeakIntHashMapIterator(Iterator> iterator) {
this.iterator = iterator;
findNext();
}
@Override
public boolean hasNext() {
return value != null;
}
@Override
public V next() {
V value = this.value;
findNext();
return value;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
private void findNext() {
value = null;
while (iterator.hasNext()) {
WeakIntEntry entry = iterator.next();
value = entry.get();
if (value != null) {
break;
}
}
}
}