public class StoredCollections
extends java.lang.Object
This class consists exclusively of static methods that operate on or return stored collections and maps, jointly called containers. It contains methods for changing certain properties of a container. Because container properties are immutable, these methods always return a new container instance. This allows stored container instances to be used safely by multiple threads. Creating the new container instance is not expensive and creates only two new objects.
When a container is created with a particular property, all containers and iterators derived from that container will inherit the property. For example, if a read-uncommitted Map is created then calls to its subMap(), values(), entrySet(), and keySet() methods will create read-uncommitted containers also.
Method names beginning with "configured" create a new container with a
specified CursorConfig
from a given stored container. This allows
configuring a container for read-committed isolation, read-uncommitted
isolation, or any other property supported by CursorConfig
.
All operations performed with the resulting container will be performed with
the specified cursor configuration.
Modifier and Type | Method and Description |
---|---|
static <E> java.util.Collection<E> |
configuredCollection(java.util.Collection<E> storedCollection,
CursorConfig config)
Creates a configured collection from a given stored collection.
|
static <E> java.util.List<E> |
configuredList(java.util.List<E> storedList,
CursorConfig config)
Creates a configured list from a given stored list.
|
static <K,V> java.util.Map<K,V> |
configuredMap(java.util.Map<K,V> storedMap,
CursorConfig config)
Creates a configured map from a given stored map.
|
static <E> java.util.Set<E> |
configuredSet(java.util.Set<E> storedSet,
CursorConfig config)
Creates a configured set from a given stored set.
|
static <K,V> java.util.SortedMap<K,V> |
configuredSortedMap(java.util.SortedMap<K,V> storedSortedMap,
CursorConfig config)
Creates a configured sorted map from a given stored sorted map.
|
static <E> java.util.SortedSet<E> |
configuredSortedSet(java.util.SortedSet<E> storedSortedSet,
CursorConfig config)
Creates a configured sorted set from a given stored sorted set.
|
static <E> java.util.Iterator<E> |
iterator(java.util.Iterator<E> iter)
Clones an iterator preserving its current position.
|
public static <E> java.util.Collection<E> configuredCollection(java.util.Collection<E> storedCollection, CursorConfig config)
E
- the element class.storedCollection
- the base collection.config
- is the cursor configuration to be used for all operations
performed via the new collection instance; null may be specified to use
the default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <E> java.util.List<E> configuredList(java.util.List<E> storedList, CursorConfig config)
Note that this method may not be called in the JE product, since the StoredList class is not supported.
E
- the element class.storedList
- the base list.config
- is the cursor configuration to be used for all operations
performed via the new list instance; null may be specified to use the
default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <K,V> java.util.Map<K,V> configuredMap(java.util.Map<K,V> storedMap, CursorConfig config)
K
- the key class.V
- the value class.storedMap
- the base map.config
- is the cursor configuration to be used for all operations
performed via the new map instance; null may be specified to use the
default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <E> java.util.Set<E> configuredSet(java.util.Set<E> storedSet, CursorConfig config)
E
- the element class.storedSet
- the base set.config
- is the cursor configuration to be used for all operations
performed via the new set instance; null may be specified to use the
default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <K,V> java.util.SortedMap<K,V> configuredSortedMap(java.util.SortedMap<K,V> storedSortedMap, CursorConfig config)
K
- the key class.V
- the value class.storedSortedMap
- the base map.config
- is the cursor configuration to be used for all operations
performed via the new map instance; null may be specified to use the
default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <E> java.util.SortedSet<E> configuredSortedSet(java.util.SortedSet<E> storedSortedSet, CursorConfig config)
E
- the element class.storedSortedSet
- the base set.config
- is the cursor configuration to be used for all operations
performed via the new set instance; null may be specified to use the
default configuration.java.lang.ClassCastException
- if the given container is not a
StoredContainer.public static <E> java.util.Iterator<E> iterator(java.util.Iterator<E> iter)
E
- the element class.iter
- an iterator to clone.Iterator
having the same position as the given
iterator.java.lang.ClassCastException
- if the given iterator was not obtained via a
StoredCollection
method.Copyright (c) 1996, 2019 Oracle and/or its affiliates. All rights reserved.