ehcache

net.sf.ehcache.store
Class CacheKeySet<E>

java.lang.Object
  extended by net.sf.ehcache.store.CacheKeySet<E>
Type Parameters:
E - the type of elements maintained by this set
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class CacheKeySet<E>
extends Object
implements Set<E>

A Set of keys that will encapsulate keys present in a Cache. It will mostly behave as an immutable Set, but for its size() method

Author:
Alex Snaps

Constructor Summary
CacheKeySet(Collection<E>... keySets)
          Create a new Set for all tiers in the cache.
 
Method Summary
 boolean add(Object o)
          You can't add to this set, will throw!
 boolean addAll(Collection c)
          You can't add to this set, will throw!
 void clear()
          You can't remove from this set, will throw!
 boolean contains(Object o)
          
 boolean containsAll(Collection<?> c)
          
 boolean isEmpty()
          
 Iterator<E> iterator()
          
 boolean remove(Object o)
          You can't remove from this set, will throw!
 boolean removeAll(Collection<?> c)
          You can't remove from this set, will throw!
 boolean retainAll(Collection<?> c)
          You can't remove from this set, will throw!
 int size()
          Sums the size of all sets wrapped by this one, so this will not account for duplicated keys.
 Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

CacheKeySet

public CacheKeySet(Collection<E>... keySets)
Create a new Set for all tiers in the cache. Generally, you'd pass the authority's keySet, and higher layer pinned keySets

Parameters:
keySets - an array of keySets
Method Detail

size

public int size()
Sums the size of all sets wrapped by this one, so this will not account for duplicated keys. Like for in-memory pinned keys, that might also present in lower tiers: e.g. DiskStore when its capacity isn't reached.

Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Returns:
the sum of all keySet sizes

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>

contains

public boolean contains(Object o)

Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>

iterator

public Iterator<E> iterator()

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

public <T> T[] toArray(T[] a)

Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

add

public boolean add(Object o)
You can't add to this set, will throw!

Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Throws:
UnsupportedOperationException

remove

public boolean remove(Object o)
You can't remove from this set, will throw!

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Throws:
UnsupportedOperationException

containsAll

public boolean containsAll(Collection<?> c)

Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

addAll

public boolean addAll(Collection c)
You can't add to this set, will throw!

Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>
Throws:
UnsupportedOperationException

removeAll

public boolean removeAll(Collection<?> c)
You can't remove from this set, will throw!

Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>
Throws:
UnsupportedOperationException

retainAll

public boolean retainAll(Collection<?> c)
You can't remove from this set, will throw!

Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>
Throws:
UnsupportedOperationException

clear

public void clear()
You can't remove from this set, will throw!

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Throws:
UnsupportedOperationException

ehcache

Copyright 2001-2014, Terracotta, Inc.