edu.mayo.bsi.ngsportal.shared
Class CaseInsensitiveSet
java.lang.Object
edu.mayo.bsi.ngsportal.shared.CaseInsensitiveSet
- All Implemented Interfaces:
- Iterable<String>, Collection<String>, Set<String>
public class CaseInsensitiveSet
- extends Object
- implements Set<String>
A set class for holding SQL Strings, since SQL Strings are case insensitive
@author Gregory Dougherty
CaseInsensitiveSet
public CaseInsensitiveSet()
- Create a Case-insensitive Set based upon a
HashSet
CaseInsensitiveSet
public CaseInsensitiveSet(Set<String> parentSet)
- Create a Case-insensitive Set, that uses the sorting, etc. of the passed in set. This
constructor violates the
Set Contract, because this constructor takes
ownership of the passed in Set, rather than just copying it, which is what
it's supposed to do. If parentSet is a HashSet, it will be cloned, if it is a
TreeSet it will be copied as a TreeSet, in which case the contract will be fulfilled.
- Parameters:
parentSet - Set that forms the core of this set. Any items in parentSet will be re-added
in a case-insensitive manner, in the sort order of parentSet (if any)
size
public int size()
- Specified by:
size in interface Collection<String>- Specified by:
size in interface Set<String>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<String>- Specified by:
isEmpty in interface Set<String>
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<String>- Specified by:
contains in interface Set<String>
iterator
public Iterator<String> iterator()
- Specified by:
iterator in interface Iterable<String>- Specified by:
iterator in interface Collection<String>- Specified by:
iterator in interface Set<String>
toArray
public Object[] toArray()
- Specified by:
toArray in interface Collection<String>- Specified by:
toArray in interface Set<String>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray in interface Collection<String>- Specified by:
toArray in interface Set<String>
add
public boolean add(String key)
- Specified by:
add in interface Collection<String>- Specified by:
add in interface Set<String>
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<String>- Specified by:
remove in interface Set<String>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll in interface Collection<String>- Specified by:
containsAll in interface Set<String>
addAll
public boolean addAll(Collection<? extends String> c)
- Specified by:
addAll in interface Collection<String>- Specified by:
addAll in interface Set<String>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<String>- Specified by:
retainAll in interface Set<String>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<String>- Specified by:
removeAll in interface Set<String>
clear
public void clear()
- Specified by:
clear in interface Collection<String>- Specified by:
clear in interface Set<String>
toString
public String toString()
- Overrides:
toString in class Object