org.apache.commons.classscan.util
Class ReadOnlySet<V>

java.lang.Object
  extended by org.apache.commons.classscan.util.ReadOnlySet<V>
Type Parameters:
V - The contained type
All Implemented Interfaces:
Iterable<V>, Collection<V>, Set<V>
Direct Known Subclasses:
ResolveSet

public class ReadOnlySet<V>
extends Object
implements Set<V>

Set of immutable instances.


Field Summary
protected  V[] values
           
 
Constructor Summary
protected ReadOnlySet()
          Subclasses may use this constructor to delay initialization of values.
  ReadOnlySet(V[] values)
           
 
Method Summary
 boolean add(V e)
           
 boolean addAll(Collection<? extends V> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> collection)
           
 boolean isEmpty()
           
 Iterator<V> iterator()
           
 boolean remove(Object e)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
protected  void setValues(V[] values)
           
 int size()
           
 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
 

Field Detail

values

protected V[] values
Constructor Detail

ReadOnlySet

public ReadOnlySet(V[] values)

ReadOnlySet

protected ReadOnlySet()
Subclasses may use this constructor to delay initialization of values. The derived class must call setValues before general use.

Method Detail

setValues

protected void setValues(V[] values)
Parameters:
values - The array to view

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<V>
Specified by:
contains in interface Set<V>

containsAll

public boolean containsAll(Collection<?> collection)
Specified by:
containsAll in interface Collection<V>
Specified by:
containsAll in interface Set<V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<V>
Specified by:
isEmpty in interface Set<V>

iterator

public Iterator<V> iterator()
Specified by:
iterator in interface Iterable<V>
Specified by:
iterator in interface Collection<V>
Specified by:
iterator in interface Set<V>

size

public int size()
Specified by:
size in interface Collection<V>
Specified by:
size in interface Set<V>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<V>
Specified by:
toArray in interface Set<V>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<V>
Specified by:
toArray in interface Set<V>

add

public final boolean add(V e)
Specified by:
add in interface Collection<V>
Specified by:
add in interface Set<V>

addAll

public final boolean addAll(Collection<? extends V> c)
Specified by:
addAll in interface Collection<V>
Specified by:
addAll in interface Set<V>

clear

public final void clear()
Specified by:
clear in interface Collection<V>
Specified by:
clear in interface Set<V>

remove

public final boolean remove(Object e)
Specified by:
remove in interface Collection<V>
Specified by:
remove in interface Set<V>

removeAll

public final boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<V>
Specified by:
removeAll in interface Set<V>

retainAll

public final boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<V>
Specified by:
retainAll in interface Set<V>


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.