net.jini.core.constraint
Class ArraySet

java.lang.Object
  extended by net.jini.core.constraint.ArraySet
All Implemented Interfaces:
Iterable, Collection, Set

final class ArraySet
extends Object
implements Set

An immutable set backed by an array. Any attempts to modify the set result in UnsupportedOperationException being thrown.

Author:
Sun Microsystems, Inc.

Nested Class Summary
private  class ArraySet.Iter
          Simple iterator.
 
Field Summary
private  Object[] elements
          The array.
 
Constructor Summary
ArraySet(Object[] elements)
          Creates an instance from an array.
 
Method Summary
 boolean add(Object o)
          Always throws UnsupportedOperationException.
 boolean addAll(Collection c)
          Always throws UnsupportedOperationException.
 void clear()
          Always throws UnsupportedOperationException.
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object o)
          Always throws UnsupportedOperationException.
 boolean removeAll(Collection c)
          Always throws UnsupportedOperationException.
 boolean retainAll(Collection c)
          Always throws UnsupportedOperationException.
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

elements

private final Object[] elements
The array.

Constructor Detail

ArraySet

ArraySet(Object[] elements)
Creates an instance from an array. The array is not copied.

Method Detail

size

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

isEmpty

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

contains

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

iterator

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

toArray

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

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set

add

public boolean add(Object o)
Always throws UnsupportedOperationException.

Specified by:
add in interface Collection
Specified by:
add in interface Set

remove

public boolean remove(Object o)
Always throws UnsupportedOperationException.

Specified by:
remove in interface Collection
Specified by:
remove in interface Set

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface Set

addAll

public boolean addAll(Collection c)
Always throws UnsupportedOperationException.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set

retainAll

public boolean retainAll(Collection c)
Always throws UnsupportedOperationException.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface Set

removeAll

public boolean removeAll(Collection c)
Always throws UnsupportedOperationException.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface Set

clear

public void clear()
Always throws UnsupportedOperationException.

Specified by:
clear in interface Collection
Specified by:
clear in interface Set

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection
Specified by:
equals in interface Set
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface Set
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.