![JAR search and dependency download from the Maven repository](/logo.png)
com.tangosol.coherence.jcache.common.MapEntryIteratorToCacheEntryIteratorAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence-jcache Show documentation
Show all versions of coherence-jcache Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.coherence.jcache.common;
import java.util.Iterator;
import java.util.Map;
import javax.cache.Cache;
/**
* An adapter that converts an {@link Iterator} over {@link Map} entries
* into an {@link Iterator} over {@link Cache} entries.
*
* @param the type of the keys
* @param the type of the values
*
* @author bo 2013.10.24
* @since Coherence 12.1.3
*/
public class MapEntryIteratorToCacheEntryIteratorAdapter
implements Iterator>
{
// ----- constructors ---------------------------------------------------
/**
* Constructs a {@link MapEntryIteratorToCacheEntryIteratorAdapter}
* that lazily adapts an {@link Iterator} over {@link Map} entries in
* to an {@link Iterator} over {@link Cache} entries.
*
* @param iterMap the {@link Map} entry {@link Iterator}
*/
public MapEntryIteratorToCacheEntryIteratorAdapter(Iterator> iterMap)
{
m_iterMap = iterMap;
}
// ----- Iterator interface ------------------------------------------
@Override
public boolean hasNext()
{
return m_iterMap.hasNext();
}
@Override
public Cache.Entry next()
{
return new CoherenceCacheEntry(m_iterMap.next());
}
@Override
public void remove()
{
throw new UnsupportedOperationException("Can't remove from a " + this.getClass().getName());
}
// ------ data members --------------------------------------------------
/**
* The underlying {@link Map} entry {@link Iterator}.
*/
private Iterator> m_iterMap;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy