Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r471186 | scolebourne | 2006-11-04 05:47:51 -0800 (Sat, 04 Nov 2006) | 1 line Remove getSet() and getSortedSet() - use decorated() ------------------------------------------------------------------------ r471173 | scolebourne | 2006-11-04 04:07:39 -0800 (Sat, 04 Nov 2006) | 1 line Abstract*Decorator - Generify and use covariant return types ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c9bf23bf6
commit
51ed546f9c
|
@ -25,12 +25,18 @@ import java.util.SortedSet;
|
||||||
* <p>
|
* <p>
|
||||||
* Methods are forwarded directly to the decorated set.
|
* Methods are forwarded directly to the decorated set.
|
||||||
*
|
*
|
||||||
|
* @param <E> the type of the elements in the sorted set
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$ $Date$
|
* @version $Revision$ $Date$
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSortedSetDecorator extends AbstractSetDecorator implements SortedSet {
|
public abstract class AbstractSortedSetDecorator<E>
|
||||||
|
extends AbstractSetDecorator<E>
|
||||||
|
implements SortedSet<E> {
|
||||||
|
|
||||||
|
/** Serialization version */
|
||||||
|
private static final long serialVersionUID = -3462240946294214398L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor only used in deserialization, do not use otherwise.
|
* Constructor only used in deserialization, do not use otherwise.
|
||||||
|
@ -46,42 +52,42 @@ public abstract class AbstractSortedSetDecorator extends AbstractSetDecorator im
|
||||||
* @param set the set to decorate, must not be null
|
* @param set the set to decorate, must not be null
|
||||||
* @throws IllegalArgumentException if set is null
|
* @throws IllegalArgumentException if set is null
|
||||||
*/
|
*/
|
||||||
protected AbstractSortedSetDecorator(Set set) {
|
protected AbstractSortedSetDecorator(Set<E> set) {
|
||||||
super(set);
|
super(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sorted set being decorated.
|
* Gets the set being decorated.
|
||||||
*
|
*
|
||||||
* @return the decorated set
|
* @return the decorated set
|
||||||
*/
|
*/
|
||||||
protected SortedSet getSortedSet() {
|
protected SortedSet<E> decorated() {
|
||||||
return (SortedSet) getCollection();
|
return (SortedSet<E>) super.decorated();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public SortedSet subSet(Object fromElement, Object toElement) {
|
public SortedSet<E> subSet(E fromElement, E toElement) {
|
||||||
return getSortedSet().subSet(fromElement, toElement);
|
return decorated().subSet(fromElement, toElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet headSet(Object toElement) {
|
public SortedSet<E> headSet(E toElement) {
|
||||||
return getSortedSet().headSet(toElement);
|
return decorated().headSet(toElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet tailSet(Object fromElement) {
|
public SortedSet<E> tailSet(E fromElement) {
|
||||||
return getSortedSet().tailSet(fromElement);
|
return decorated().tailSet(fromElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object first() {
|
public E first() {
|
||||||
return getSortedSet().first();
|
return decorated().first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object last() {
|
public E last() {
|
||||||
return getSortedSet().last();
|
return decorated().last();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Comparator comparator() {
|
public Comparator<? super E> comparator() {
|
||||||
return getSortedSet().comparator();
|
return decorated().comparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue