|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.molae.pipe.basic.ObjectProxy<B> net.sf.molae.pipe.basic.CollectionProxy<B,E> net.sf.molae.pipe.basic.CollectionAsSet<B,E>
public class CollectionAsSet<B extends Collection<E>,E>
If it can be guaranteed that a collection is a set,
this wrapper can be used to create a Set
implementation.
Constructor Summary | |
---|---|
CollectionAsSet(B base)
Constructs a new CollectionAsSet object. |
Method Summary | ||
---|---|---|
boolean |
equals(Object o)
Compares the specified object with this set for equality. |
|
int |
hashCode()
Returns the hash code value for this set. |
|
static boolean |
isSet(Collection<?> col)
Checks if the specified collection is a set. |
|
static
|
newInstance(Collection<E> base)
Constructs a new CollectionAsSet object. |
Methods inherited from class net.sf.molae.pipe.basic.CollectionProxy |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from class net.sf.molae.pipe.basic.ObjectProxy |
---|
assertNotNull, getBase, toString, toVerboseString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public CollectionAsSet(B base)
base
- the underlying object.
NullPointerException
- if the specified object is
null
.Method Detail |
---|
public static boolean isSet(Collection<?> col)
col
- collection to check
true
if the specified collection is a set,
that is no two elements in it are equal.public static <E> CollectionAsSet<Collection<E>,E> newInstance(Collection<E> base)
base
- the underlying object.
NullPointerException
- if the specified object is
null
.public boolean equals(Object o)
This implementation first checks if the specified object is this set; if so it returns true. Then, it checks if the specified object is a set whose size is identical to the size of this set; if not, it it returns false. If so, it returns containsAll((Collection) o).
Copied from AbstractSet
.
equals
in interface Collection<E>
equals
in interface Set<E>
equals
in class ObjectProxy<B extends Collection<E>>
o
- Object to be compared for equality with this set.
public int hashCode()
Copied from AbstractSet
.
hashCode
in interface Collection<E>
hashCode
in interface Set<E>
hashCode
in class ObjectProxy<B extends Collection<E>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |