Package com.cedarsoftware.util
Class CaseInsensitiveSet<E>
- java.lang.Object
-
- com.cedarsoftware.util.CaseInsensitiveSet<E>
-
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
public class CaseInsensitiveSet<E> extends Object implements Set<E>
Implements a java.util.Set that will not utilize 'case' when comparing Strings contained within the Set. The set can be homogeneous or heterogeneous. If the CaseInsensitiveSet is iterated, when Strings are encountered, the original Strings are returned (retains case).- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
-
Constructor Summary
Constructors Constructor Description CaseInsensitiveSet()
CaseInsensitiveSet(int initialCapacity)
CaseInsensitiveSet(int initialCapacity, float loadFactor)
CaseInsensitiveSet(Collection<? extends E> collection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E e)
boolean
addAll(Collection<? extends E> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object other)
int
hashCode()
boolean
isEmpty()
Iterator<E>
iterator()
Set
minus(Iterable removeMe)
Set
minus(Object removeMe)
Set
plus(Iterable right)
Set
plus(Object right)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Constructor Detail
-
CaseInsensitiveSet
public CaseInsensitiveSet()
-
CaseInsensitiveSet
public CaseInsensitiveSet(Collection<? extends E> collection)
-
CaseInsensitiveSet
public CaseInsensitiveSet(int initialCapacity)
-
CaseInsensitiveSet
public CaseInsensitiveSet(int initialCapacity, float loadFactor)
-
-
Method Detail
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object other)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(E e)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
clear
public void clear()
-
-