All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.venky.core.collections.IgnoreCaseSet Maven / Gradle / Ivy

There is a newer version: 1.18
Show newest version
package com.venky.core.collections;

import java.util.Comparator;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;

import com.venky.core.checkpoint.Mergeable;
import com.venky.core.util.ObjectUtil;

public class IgnoreCaseSet extends AbstractIgnoreCaseCollection implements SortedSet,Cloneable, Mergeable{
	private TreeSet inner = new TreeSet();

	public boolean equals(Object o) {
		return inner.equals(o);
	}

	public int hashCode() {
		return inner.hashCode();
	}

	public Object[] toArray() {
		return inner.toArray();
	}

	public  T[] toArray(T[] a) {
		return inner.toArray(a);
	}

	public Iterator iterator() {
		return inner.iterator();
	}

	public int size() {
		return inner.size();
	}

	public boolean isEmpty() {
		return inner.isEmpty();
	}

	public boolean contains(Object o) {
		return inner.contains(ucase(o));
	}

	public boolean add(String e) {
		return inner.add(ucase(e));
	}

	public boolean remove(Object o) {
		return inner.remove(ucase(o));
	}

	public void clear() {
		inner.clear();
	}

	@SuppressWarnings("unchecked")
	public IgnoreCaseSet clone() {
		IgnoreCaseSet clone;
		try {
			clone = (IgnoreCaseSet)super.clone();
			clone.inner = (TreeSet)this.inner.clone();
			return clone;
		} catch (CloneNotSupportedException e) {
			throw new RuntimeException(e);
		}
	}

	public String toString() {
		return inner.toString();
	}

	public Comparator comparator() {
		return inner.comparator();
	}

	public SortedSet subSet(String fromElement, String toElement) {
		return inner.subSet(ucase(fromElement), ucase(toElement));
	}

	public SortedSet headSet(String toElement) {
		return inner.headSet(ucase(toElement));
	}

	public SortedSet tailSet(String fromElement) {
		return inner.tailSet(ucase(fromElement));
	}

	public String first() {
		return inner.first();
	}

	public String last() {
		return inner.last();
	}

	public void merge(IgnoreCaseSet another) {
		ObjectUtil.mergeValues(another, this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy