public class ListSet<T>
extends java.lang.Object
implements java.util.Set<T>, java.lang.Cloneable, java.io.Serializable
构造器和说明 |
---|
ListSet()
Creates new ListSet
|
ListSet(java.util.Collection<T> c)
Creates new ListSet from an existing Collection.
|
ListSet(int initialCapacity)
Creates new ListSet specifying the initial capacity.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(int index,
T o)
Adds the specified element to this set if it is not already present, at the specified index.
|
boolean |
add(T o)
Adds the specified element to this set if it is not already present.
|
boolean |
addAll(java.util.Collection<? extends T> c)
Adds all of the elements in the specified collection to this set if they're not already present.
|
void |
clear()
Removes all of the elements from this set.
|
java.lang.Object |
clone()
Returns a clone of the Set.
|
boolean |
contains(java.lang.Object o)
Returns true if this set contains the specified element.
|
boolean |
containsAll(java.util.Collection<?> c)
Returns true if this set contains all of the elements of the specified collection.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this set for equality.
|
T |
get(int index)
Returns the element from the specified position.
|
int |
hashCode()
Returns the hash code value for this set.
|
int |
indexOf(java.lang.Object o)
Returns the index of the element in this set.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements in this set.
|
java.lang.Object |
remove(int index)
Remove the element from the specified position.
|
boolean |
remove(java.lang.Object o)
Removes the specified element from this set if it is present.
|
boolean |
removeAll(java.util.Collection<?> c)
Removes from this set all of its elements that are contained in the specified collection.
|
boolean |
retainAll(java.util.Collection<?> c)
Retains only the elements in this set that are contained in the specified collection.
|
int |
size()
Returns the number of elements in this set.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this set.
|
<E> E[] |
toArray(E[] a)
Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.
|
public ListSet()
public ListSet(int initialCapacity)
initialCapacity
- The initial capacity.public ListSet(java.util.Collection<T> c)
c
- An existing collection.public boolean retainAll(java.util.Collection<?> c)
public boolean contains(java.lang.Object o)
public java.lang.Object[] toArray()
public <E> E[] toArray(E[] a)
toArray
在接口中 java.util.Collection<T>
toArray
在接口中 java.util.Set<T>
a
- the array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.public java.util.Iterator<T> iterator()
public boolean removeAll(java.util.Collection<?> c)
public boolean remove(java.lang.Object o)
public void clear()
public int hashCode()
public boolean addAll(java.util.Collection<? extends T> c)
public int size()
public boolean containsAll(java.util.Collection<?> c)
public boolean add(T o)
public boolean equals(java.lang.Object o)
public boolean isEmpty()
public boolean add(int index, T o)
index
- The position at which the element is to be added.o
- element to be added to this set.public T get(int index)
index
- The position from which the element is to be retrieved.public java.lang.Object remove(int index)
index
- The position from which the element is to be removed.public int indexOf(java.lang.Object o)
o
- The element whose index is to be found.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
在类中 java.lang.Object
java.lang.CloneNotSupportedException
- if cloning is not supported. Should never happen.