CaseInsensitiveHashSet.java revision 861fc14ed1f9fd9538580a9137c266c2ec804a1e
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: CaseInsensitiveHashSet.java,v 1.4 2008/06/25 05:42:25 qcheng Exp $
*
* Portions copyright 2015 ForgeRock AS.
*/
/**
* An implementation of Case Insensitive Hash Set with case preservation.
* Strings are converted to case insensitive strings before being hashed, but
* original case is preserved. The iterator returns the case preserved Strings
* that can be casted to a String, no different from an iterator from the
* standard Hash Set.
*/
public class CaseInsensitiveHashSet extends HashSet {
static private class CaseInsensitiveKeyIterator implements Iterator {
}
public boolean hasNext() {
}
if (nextIter instanceof CaseInsensitiveKey) {
} else {
return nextIter;
}
}
public void remove() {
}
}
public CaseInsensitiveHashSet() {
super();
}
public CaseInsensitiveHashSet(Collection c) {
super(c);
}
public CaseInsensitiveHashSet(int initialCapacity) {
super(initialCapacity);
}
super(initialCapacity, loadFactor);
}
boolean retval;
if (o instanceof String) {
} else {
}
return retval;
}
boolean retval;
if (o instanceof String) {
} else {
}
return retval;
}
boolean retval;
if (o instanceof String) {
} else {
}
return retval;
}
/**
* @return an iterator of objects in the set, no different than iterator
* from the standard HashSet.
*/
// The CaseInsensitiveKeyIterator allows the iterator to return
// elements as regular strings.
return new CaseInsensitiveKeyIterator(super.iterator());
}
}
/**
* Removes all elements specified in the parameter collection from the current set.
*
* @param c The collection of elements that need to be removed from this set.
* @return <code>true</code> if at least one element has been removed from this set.
* @see java.util.AbstractSet#removeAll(java.util.Collection)
*/
public boolean removeAll(Collection c) {
// Override to ensure that the collection we are removing
// is an instance of CaseInsensitiveHashSet
if (c instanceof CaseInsensitiveHashSet) {
return super.removeAll(c);
} else {
}
}
/**
* @return an array containing objects in the set, no different than an
* array returned from the standard HashSet.
*/
ret = a;
} else {
}
if (arr[i] instanceof CaseInsensitiveKey) {
} else {
}
}
}
return ret;
}
}