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

org.ssssssss.script.runtime.lang.MapKeyValueIterator Maven / Gradle / Ivy

The newest version!
package org.ssssssss.script.runtime.lang;

import java.util.Iterator;
import java.util.Map;

public class MapKeyValueIterator implements Iterator, KeyIterator{

	private final Iterator> iterator;

	private Map.Entry current;

	public MapKeyValueIterator(Map target){
		this.iterator = target.entrySet().iterator();
	}

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

	@Override
	public Object next() {
		current = iterator.next();
		return current.getValue();
	}

	@Override
	public Object getKey(){
		return current.getKey();
	}
}