com.sleepycat.collections
Class StoredEntrySet<K,V>

java.lang.Object
  extended by com.sleepycat.collections.StoredContainer
      extended by com.sleepycat.collections.StoredCollection<java.util.Map.Entry<K,V>>
          extended by com.sleepycat.collections.StoredEntrySet<K,V>
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<java.util.Map.Entry<K,V>>, java.util.Collection<java.util.Map.Entry<K,V>>, java.util.Set<java.util.Map.Entry<K,V>>
Direct Known Subclasses:
StoredSortedEntrySet

public class StoredEntrySet<K,V>
extends StoredCollection<java.util.Map.Entry<K,V>>
implements java.util.Set<java.util.Map.Entry<K,V>>

The Set returned by Map.entrySet(). This class may not be instantiated directly. Contrary to what is stated by Map.entrySet() this class does support the add(java.util.Map.Entry) and StoredCollection.addAll(java.util.Collection) methods.

The Map.Entry.setValue(V) method of the Map.Entry objects that are returned by this class and its iterators behaves just as the StoredIterator.set(E) method does.

Author:
Mark Hayes

Field Summary
 
Fields inherited from class com.sleepycat.collections.StoredCollection
DEFAULT_ITERATOR_BLOCK_SIZE
 
Fields inherited from class com.sleepycat.collections.StoredContainer
view
 
Constructor Summary
StoredEntrySet(DataView mapView)
           
 
Method Summary
 boolean add(java.util.Map.Entry<K,V> mapEntry)
          Adds the specified element to this set if it is not already present (optional operation).
 boolean contains(java.lang.Object mapEntry)
          Returns true if this set contains the specified element.
(package private)  boolean hasValues()
           
(package private)  java.util.Map.Entry<K,V> makeIteratorData(BaseIterator iterator, DatabaseEntry keyEntry, DatabaseEntry priKeyEntry, DatabaseEntry valueEntry)
           
 boolean remove(java.lang.Object mapEntry)
          Removes the specified element from this set if it is present (optional operation).
 java.lang.String toString()
          Converts the collection to a string representation for debugging.
 
Methods inherited from class com.sleepycat.collections.StoredCollection
add, addAll, blockIterator, checkIterAddAllowed, containsAll, equals, getFirstOrLast, getIndexOffset, getIteratorBlockSize, hashCode, iterateDuplicates, iterator, iterator, join, makeIteratorData, removeAll, retainAll, setIteratorBlockSize, size, storedIterator, storedIterator, toArray, toArray, toList
 
Methods inherited from class com.sleepycat.collections.StoredContainer
areDuplicatesAllowed, areDuplicatesOrdered, areKeyRangesAllowed, areKeysRenumbered, beginAutoCommit, clear, closeCursor, commitAutoCommit, configuredClone, containsKey, containsValue, convertException, getCursorConfig, getValue, handleException, initAfterClone, isDirtyRead, isDirtyReadAllowed, isEmpty, isOrdered, isSecondary, isTransactional, isWriteAllowed, putKeyValue, removeKey, removeValue, storedOrExternalIterator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

StoredEntrySet

StoredEntrySet(DataView mapView)
Method Detail

add

public boolean add(java.util.Map.Entry<K,V> mapEntry)
Adds the specified element to this set if it is not already present (optional operation). This method conforms to the Set.add(E) interface.

Specified by:
add in interface java.util.Collection<java.util.Map.Entry<K,V>>
Specified by:
add in interface java.util.Set<java.util.Map.Entry<K,V>>
Parameters:
mapEntry - must be a Map.Entry instance.
Returns:
true if the key-value pair was added to the set (and was not previously present).
Throws:
java.lang.UnsupportedOperationException - if the collection is read-only.
java.lang.ClassCastException - if the mapEntry is not a Map.Entry instance.
RuntimeExceptionWrapper - if a DatabaseException is thrown.

remove

public boolean remove(java.lang.Object mapEntry)
Removes the specified element from this set if it is present (optional operation). This method conforms to the Set.remove(java.lang.Object) interface.

Specified by:
remove in interface java.util.Collection<java.util.Map.Entry<K,V>>
Specified by:
remove in interface java.util.Set<java.util.Map.Entry<K,V>>
Parameters:
mapEntry - is a Map.Entry instance to be removed.
Returns:
true if the key-value pair was removed from the set, or false if the mapEntry is not a Map.Entry instance or is not present in the set.
Throws:
java.lang.UnsupportedOperationException - if the collection is read-only.
RuntimeExceptionWrapper - if a DatabaseException is thrown.

contains

public boolean contains(java.lang.Object mapEntry)
Returns true if this set contains the specified element. This method conforms to the Set.contains(java.lang.Object) interface.

Specified by:
contains in interface java.util.Collection<java.util.Map.Entry<K,V>>
Specified by:
contains in interface java.util.Set<java.util.Map.Entry<K,V>>
Parameters:
mapEntry - is a Map.Entry instance to be checked.
Returns:
true if the key-value pair is present in the set, or false if the mapEntry is not a Map.Entry instance or is not present in the set.
Throws:
RuntimeExceptionWrapper - if a DatabaseException is thrown.

toString

public java.lang.String toString()
Description copied from class: StoredCollection
Converts the collection to a string representation for debugging. WARNING: The returned string may be very large.

Overrides:
toString in class StoredCollection<java.util.Map.Entry<K,V>>
Returns:
the string representation.

makeIteratorData

java.util.Map.Entry<K,V> makeIteratorData(BaseIterator iterator,
                                          DatabaseEntry keyEntry,
                                          DatabaseEntry priKeyEntry,
                                          DatabaseEntry valueEntry)
Specified by:
makeIteratorData in class StoredCollection<java.util.Map.Entry<K,V>>

hasValues

boolean hasValues()
Specified by:
hasValues in class StoredCollection<java.util.Map.Entry<K,V>>


Copyright (c) 2004,2008 Oracle. All rights reserved.