T - the value typepublic class MiniSet1<T> extends MiniSet<T>
MiniSet containing a single value.| Modifier and Type | Class and Description |
|---|---|
class |
MiniSet1.Miniterator
An
Iterator over a set with a single value. |
| Constructor and Description |
|---|
MiniSet1(Set<T> set)
Construct a
MiniSet1 from another Set (helps with deserializing). |
MiniSet1(T value)
Construct a
MiniSet1 with the given value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object o)
Test whether the collection contains an object equal to the specified value.
|
boolean |
equals(Object other)
Compares the specified object with this set for equality.
|
int |
hashCode()
Returns the hash code value for this set.
|
boolean |
isEmpty()
Return
false to indicate that the set is not empty. |
Iterator<T> |
iterator()
Return an
Iterator over the set. |
int |
size()
Get the number of values (always one).
|
Object[] |
toArray()
Copy the set to an array.
|
<TT> TT[] |
toArray(TT[] a)
Copy the set to an array, either the supplied array (if it fits) or a new array of the specified type.
|
String |
toString()
Returns a string representation of this set.
|
add, addAll, clear, containsAll, of, of, of, of, of, of, of, remove, removeAll, retainAll, stringOfclone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratorparallelStream, removeIf, streampublic MiniSet1(T value)
MiniSet1 with the given value.value - the valuepublic MiniSet1(Set<T> set)
MiniSet1 from another Set (helps with deserializing).set - the other SetIllegalArgumentException - if the size of the other set is not 1public int size()
public boolean isEmpty()
false to indicate that the set is not empty.falsepublic boolean contains(Object o)
o - the objecttrue if the single value is equal to the objectpublic Object[] toArray()
public <TT> TT[] toArray(TT[] a)
TT - the type of the destination array itemsa - the destination arrayArrayStoreException - if the values in the collection can't be stored in the destination arraypublic boolean equals(Object other)
true if the specified object is also a
set containing a single value identical to that of this set.public int hashCode()
Copyright © 2023. All rights reserved.