public class CaseInsensitiveSet extends SetDecorator<String>
iterator()
method for example returns the originally values.
Note: The behavior of this class is undefined when wrapping a set that has keys that would result in duplicate case-insensitive values.
set
Constructor and Description |
---|
CaseInsensitiveSet()
Constructs a new empty case-insensitive set.
|
CaseInsensitiveSet(Collection<String> c)
Constructs a new case-insensitive set containing the elements in the specified
collection.
|
CaseInsensitiveSet(int initialCapacity)
Constructs a new, empty case-insensitive set; the backing
HashSet instance has
the specified initial capacity and default load factor. |
CaseInsensitiveSet(int initialCapacity,
float loadFactor)
Constructs a new, empty case-insensitive set; the backing
HashSet instance has
the specified initial capacity and the specified load factor. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(String e)
Adds the specified element to the set if it is not already present (optional
operation).
|
boolean |
addAll(Collection<? extends String> c)
Adds all of the elements in the specified collection to the set if they're not already
present (optional operation).
|
void |
clear()
Removes all of the elements from the set (optional operation).
|
boolean |
contains(Object o)
Returns
true if the set contains the specified element. |
boolean |
containsAll(Collection<?> c)
Returns
true if the set contains all of the elements of the specified
collection. |
boolean |
remove(Object o)
Removes the specified element from the set if it is present (optional operation).
|
boolean |
removeAll(Collection<?> c)
Removes from the set all of its elements that are contained in the specified collection
(optional operation).
|
boolean |
retainAll(Collection<?> c)
Retains only the elements in the set that are contained in the specified collection
(optional operation).
|
equals, hashCode, isEmpty, iterator, size, toArray, toArray
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
spliterator
parallelStream, removeIf, stream
public CaseInsensitiveSet()
HashSet
with default initial capacity and load factor.public CaseInsensitiveSet(Collection<String> c)
HashSet
is created with default load factor and an initial
capacity sufficient to contain the elements in the specified collection.c
- the collection whose elements are to be placed into this set.NullPointerException
- if the specified collection is null
.public CaseInsensitiveSet(int initialCapacity, float loadFactor)
HashSet
instance has
the specified initial capacity and the specified load factor.initialCapacity
- the initial capacity of the hash set.loadFactor
- the load factor of the hash set.IllegalArgumentException
- if the initial capacity is less than zero, or if the load factor is nonpositive.public CaseInsensitiveSet(int initialCapacity)
HashSet
instance has
the specified initial capacity and default load factor.initialCapacity
- the initial capacity of the hash set.IllegalArgumentException
- if the initial capacity is less than zero.public boolean contains(Object o)
SetDecorator
true
if the set contains the specified element.contains
in interface Collection<String>
contains
in interface Set<String>
contains
in class SetDecorator<String>
o
- element whose presence in the set is to be tested.true
if the set contains the specified element.public boolean add(String e)
SetDecorator
add
in interface Collection<String>
add
in interface Set<String>
add
in class SetDecorator<String>
e
- element to be added to the set.true
if the set did not already contain the specified element.public boolean remove(Object o)
SetDecorator
remove
in interface Collection<String>
remove
in interface Set<String>
remove
in class SetDecorator<String>
o
- object to be removed from the set, if present.true
if the set contained the specified element.public boolean containsAll(Collection<?> c)
SetDecorator
true
if the set contains all of the elements of the specified
collection.containsAll
in interface Collection<String>
containsAll
in interface Set<String>
containsAll
in class SetDecorator<String>
c
- collection to be checked for containment in the set.true
if the set contains all of the elements of the specified collection.public boolean addAll(Collection<? extends String> c)
SetDecorator
addAll
in interface Collection<String>
addAll
in interface Set<String>
addAll
in class SetDecorator<String>
c
- collection containing elements to be added to the set.true
if the set changed as a result of the call.public boolean retainAll(Collection<?> c)
SetDecorator
retainAll
in interface Collection<String>
retainAll
in interface Set<String>
retainAll
in class SetDecorator<String>
c
- collection containing elements to be retained in the set.true
if the set changed as a result of the call.public boolean removeAll(Collection<?> c)
SetDecorator
removeAll
in interface Collection<String>
removeAll
in interface Set<String>
removeAll
in class SetDecorator<String>
c
- collection containing elements to be removed from the set.true
if the set changed as a result of the call.public void clear()
SetDecorator
clear
in interface Collection<String>
clear
in interface Set<String>
clear
in class SetDecorator<String>
Copyright © 2010-2018, ForgeRock All Rights Reserved.