Author: scolebourne Date: Sat Nov 4 07:21:01 2006 New Revision: 471214 URL: http://svn.apache.org/viewvc?view=rev&rev=471214 Log: Generify
Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Bag.java Sat Nov 4 07:21:01 2006 @@ -38,13 +38,14 @@ * In an ideal world, the interface would be changed to fix the problems, however * it has been decided to maintain backwards compatibility instead. * + * @param <E> the type held in the bag * @since Commons Collections 2.0 * @version $Revision$ $Date$ * * @author Chuck Burdick * @author Stephen Colebourne */ -public interface Bag extends Collection { +public interface Bag<E> extends Collection<E> { /** * Returns the number of occurrences (cardinality) of the given @@ -54,7 +55,7 @@ * @param object the object to search for * @return the number of occurrences of the object, zero if not found */ - int getCount(Object object); + int getCount(E object); /** * <i>(Violation)</i> @@ -72,7 +73,7 @@ * @param object the object to add * @return <code>true</code> if the object was not already in the <code>uniqueSet</code> */ - boolean add(Object object); + boolean add(E object); /** * Adds <code>nCopies</code> copies of the specified object to the Bag. @@ -85,7 +86,7 @@ * @param nCopies the number of copies to add * @return <code>true</code> if the object was not already in the <code>uniqueSet</code> */ - boolean add(Object object, int nCopies); + boolean add(E object, int nCopies); /** * <i>(Violation)</i> @@ -111,7 +112,7 @@ * @param nCopies the number of copies to remove * @return <code>true</code> if this call changed the collection */ - boolean remove(Object object, int nCopies); + boolean remove(E object, int nCopies); /** * Returns a [EMAIL PROTECTED] Set} of unique elements in the Bag. @@ -120,7 +121,7 @@ * * @return the Set of unique Bag elements */ - Set uniqueSet(); + Set<E> uniqueSet(); /** * Returns the total number of items in the bag across all types. @@ -145,7 +146,7 @@ * @param coll the collection to check against * @return <code>true</code> if the Bag contains all the collection */ - boolean containsAll(Collection coll); + boolean containsAll(Collection<?> coll); /** * <i>(Violation)</i> @@ -163,7 +164,7 @@ * @param coll the collection to remove * @return <code>true</code> if this call changed the collection */ - boolean removeAll(Collection coll); + boolean removeAll(Collection<?> coll); /** * <i>(Violation)</i> @@ -184,7 +185,7 @@ * @param coll the collection to retain * @return <code>true</code> if this call changed the collection */ - boolean retainAll(Collection coll); + boolean retainAll(Collection<?> coll); /** * Returns an [EMAIL PROTECTED] Iterator} over the entire set of members, @@ -193,7 +194,7 @@ * * @return iterator over all elements in the Bag */ - Iterator iterator(); + Iterator<E> iterator(); // The following is not part of the formal Bag interface, however where possible // Bag implementations should follow these comments. @@ -218,5 +219,5 @@ // * @return the hash code of the Bag // */ // int hashCode(); - + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/BidiMap.java Sat Nov 4 07:21:01 2006 @@ -33,34 +33,16 @@ * This is required so that "inverting" the map results in a map without * duplicate keys. See the [EMAIL PROTECTED] #put} method description for more information. * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface BidiMap extends IterableMap { +public interface BidiMap<K, V> extends IterableMap<K, V> { /** - * Obtains a <code>MapIterator</code> over the map. - * <p> - * A map iterator is an efficient way of iterating over maps. - * It does not require that the map is stored using Map Entry objects - * which can increase performance. - * <pre> - * BidiMap map = new DualHashBidiMap(); - * MapIterator it = map.mapIterator(); - * while (it.hasNext()) { - * Object key = it.next(); - * Object value = it.getValue(); - * it.setValue("newValue"); - * } - * </pre> - * - * @return a map iterator - */ - MapIterator mapIterator(); - - /** * Puts the key-value pair into the map, replacing any previous pair. * <p> * When adding a key-value pair, the value may already exist in the map @@ -88,8 +70,8 @@ * @throws NullPointerException (optional) if the map limits the values to * non-null and null was specified */ - Object put(Object key, Object value); - + V put(K key, V value); + /** * Gets the key that is currently mapped to the specified value. * <p> @@ -106,8 +88,8 @@ * @throws NullPointerException (optional) if the map limits the values to * non-null and null was specified */ - Object getKey(Object value); - + K getKey(V value); + /** * Removes the key-value pair that is currently mapped to the specified * value (optional operation). @@ -127,8 +109,8 @@ * @throws UnsupportedOperationException if this method is not supported * by the implementation */ - Object removeValue(Object value); - + K removeValue(V value); + /** * Gets a view of this map where the keys and values are reversed. * <p> @@ -141,6 +123,6 @@ * * @return an inverted bidirectional map */ - BidiMap inverseBidiMap(); - + BidiMap<V, K> inverseBidiMap(); + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Buffer.java Sat Nov 4 07:21:01 2006 @@ -35,6 +35,7 @@ * also implement [EMAIL PROTECTED] java.util.List}, [EMAIL PROTECTED] java.util.Set} or * [EMAIL PROTECTED] Bag}. * + * @param <E> the type of the elements in the buffer * @since Commons Collections 2.1 * @version $Revision$ $Date$ * @@ -43,7 +44,7 @@ * @author Paul Jack * @author Stephen Colebourne */ -public interface Buffer extends Collection { +public interface Buffer<E> extends Collection<E> { /** * Gets and removes the next object from the buffer. @@ -51,7 +52,7 @@ * @return the next object in the buffer, which is also removed * @throws BufferUnderflowException if the buffer is already empty */ - Object remove(); + E remove(); /** * Gets the next object from the buffer without removing it. @@ -59,6 +60,6 @@ * @return the next object in the buffer, which is not removed * @throws BufferUnderflowException if the buffer is empty */ - Object get(); + E get(); } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java Sat Nov 4 07:21:01 2006 @@ -22,41 +22,43 @@ * Defines a map that can be iterated directly without needing to create an entry set. * <p> * A map iterator is an efficient way of iterating over maps. - * There is no need to access the entry set or cast to Map Entry objects. + * There is no need to access the entry set or use Map Entry objects. * <pre> - * IterableMap map = new HashedMap(); - * MapIterator it = map.mapIterator(); + * IterableMap<String,Integer> map = new HashedMap<String,Integer>(); + * MapIterator<String,Integer> it = map.mapIterator(); * while (it.hasNext()) { - * Object key = it.next(); - * Object value = it.getValue(); - * it.setValue("newValue"); + * String key = it.next(); + * Integer value = it.getValue(); + * it.setValue(value + 1); * } * </pre> * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface IterableMap extends Map { +public interface IterableMap<K, V> extends Map<K, V> { /** * Obtains a <code>MapIterator</code> over the map. * <p> * A map iterator is an efficient way of iterating over maps. - * There is no need to access the entry set or cast to Map Entry objects. + * There is no need to access the entry set or use Map Entry objects. * <pre> - * IterableMap map = new HashedMap(); - * MapIterator it = map.mapIterator(); + * IterableMap<String,Integer> map = new HashedMap<String,Integer>(); + * MapIterator<String,Integer> it = map.mapIterator(); * while (it.hasNext()) { - * Object key = it.next(); - * Object value = it.getValue(); - * it.setValue("newValue"); + * String key = it.next(); + * Integer value = it.getValue(); + * it.setValue(value + 1); * } * </pre> * * @return a map iterator */ - MapIterator mapIterator(); - + MapIterator<K, V> mapIterator(); + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/KeyValue.java Sat Nov 4 07:21:01 2006 @@ -23,25 +23,27 @@ * key-value pair. This interface defines the minimum key value, with just the * two get methods. * + * @param <K> the type of the key + * @param <V> the type of the value * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface KeyValue { +public interface KeyValue<K, V> { /** * Gets the key from the pair. * * @return the key */ - Object getKey(); + K getKey(); /** * Gets the value from the pair. * * @return the value */ - Object getValue(); + V getValue(); } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/MapIterator.java Sat Nov 4 07:21:01 2006 @@ -17,6 +17,7 @@ package org.apache.commons.collections; import java.util.Iterator; +import java.util.NoSuchElementException; /** * Defines an iterator that operates over a <code>Map</code>. @@ -32,14 +33,16 @@ * to <code>next()</code>, the <code>getValue()</code> method provides direct * access to the value. The value can also be set using <code>setValue()</code>. * <pre> - * MapIterator it = map.mapIterator(); + * MapIterator<String,Integer> it = map.mapIterator(); * while (it.hasNext()) { - * Object key = it.next(); - * Object value = it.getValue(); - * it.setValue(newValue); + * String key = it.next(); + * Integer value = it.getValue(); + * it.setValue(value + 1); * } * </pre> - * + * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * @@ -58,7 +61,7 @@ * Gets the next <em>key</em> from the <code>Map</code>. * * @return the next key in the iteration - * @throws java.util.NoSuchElementException if the iteration is finished + * @throws NoSuchElementException if the iteration is finished */ K next(); Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedBidiMap.java Sat Nov 4 07:21:01 2006 @@ -23,12 +23,14 @@ * Implementations should allow a value to be looked up from a key and * a key to be looked up from a value with equal performance. * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface OrderedBidiMap extends BidiMap, OrderedMap { +public interface OrderedBidiMap<K, V> extends BidiMap<K, V>, OrderedMap<K, V> { /** * Gets a view of this map where the keys and values are reversed. @@ -45,8 +47,8 @@ * * @return an inverted bidirectional map */ - public BidiMap inverseBidiMap(); - + public BidiMap<V, K> inverseBidiMap(); + /** * Gets a view of this map where the keys and values are reversed. * <p> @@ -59,6 +61,6 @@ * * @return an inverted bidirectional map */ - public OrderedBidiMap inverseOrderedBidiMap(); - + public OrderedBidiMap<V, K> inverseOrderedBidiMap(); + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedIterator.java Sat Nov 4 07:21:01 2006 @@ -17,18 +17,20 @@ package org.apache.commons.collections; import java.util.Iterator; +import java.util.NoSuchElementException; /** - * Defines an iterator that operates over an ordered collection. + * Defines an iterator that operates over an ordered container. * <p> - * This iterator allows both forward and reverse iteration through the collection. - * + * This iterator allows both forward and reverse iteration through the container. + * + * @param <E> the type to iterate over * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface OrderedIterator extends Iterator { +public interface OrderedIterator<E> extends Iterator<E> { /** * Checks to see if there is a previous element that can be iterated to. @@ -38,11 +40,11 @@ boolean hasPrevious(); /** - * Gets the previous element from the collection. + * Gets the previous element from the container. * * @return the previous element in the iteration - * @throws java.util.NoSuchElementException if the iteration is finished + * @throws NoSuchElementException if the iteration is finished */ - Object previous(); + E previous(); } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMap.java Sat Nov 4 07:21:01 2006 @@ -20,40 +20,32 @@ * Defines a map that maintains order and allows both forward and backward * iteration through that order. * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface OrderedMap extends IterableMap { - +public interface OrderedMap<K, V> extends IterableMap<K, V> { + /** * Obtains an <code>OrderedMapIterator</code> over the map. * <p> * A ordered map iterator is an efficient way of iterating over maps * in both directions. - * <pre> - * BidiMap map = new TreeBidiMap(); - * MapIterator it = map.mapIterator(); - * while (it.hasNext()) { - * Object key = it.next(); - * Object value = it.getValue(); - * it.setValue("newValue"); - * Object previousKey = it.previous(); - * } - * </pre> * * @return a map iterator */ - OrderedMapIterator orderedMapIterator(); - + OrderedMapIterator<K, V> orderedMapIterator(); + /** * Gets the first key currently in this map. * * @return the first key currently in this map * @throws java.util.NoSuchElementException if this map is empty */ - public Object firstKey(); + public K firstKey(); /** * Gets the last key currently in this map. @@ -61,15 +53,15 @@ * @return the last key currently in this map * @throws java.util.NoSuchElementException if this map is empty */ - public Object lastKey(); - + public K lastKey(); + /** * Gets the next key after the one specified. * * @param key the key to search for next from * @return the next key, null if no match or at end */ - public Object nextKey(Object key); + public K nextKey(K key); /** * Gets the previous key before the one specified. @@ -77,6 +69,6 @@ * @param key the key to search for previous from * @return the previous key, null if no match or at start */ - public Object previousKey(Object key); - + public K previousKey(K key); + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/OrderedMapIterator.java Sat Nov 4 07:21:01 2006 @@ -16,18 +16,22 @@ */ package org.apache.commons.collections; +import java.util.NoSuchElementException; + /** * Defines an iterator that operates over an ordered <code>Map</code>. * <p> * This iterator allows both forward and reverse iteration through the map. - * + * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface OrderedMapIterator extends MapIterator, OrderedIterator { - +public interface OrderedMapIterator<K, V> extends MapIterator<K, V>, OrderedIterator<K> { + /** * Checks to see if there is a previous entry that can be iterated to. * @@ -39,8 +43,8 @@ * Gets the previous <em>key</em> from the <code>Map</code>. * * @return the previous key in the iteration - * @throws java.util.NoSuchElementException if the iteration is finished + * @throws NoSuchElementException if the iteration is finished */ - Object previous(); + K previous(); } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableIterator.java Sat Nov 4 07:21:01 2006 @@ -23,12 +23,13 @@ * <p> * This interface allows an iterator to be repeatedly reused. * + * @param <E> the type to iterate over * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface ResettableIterator extends Iterator { +public interface ResettableIterator<E> extends Iterator<E> { /** * Resets the iterator back to the position at which the iterator Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/ResettableListIterator.java Sat Nov 4 07:21:01 2006 @@ -23,17 +23,12 @@ * <p> * This interface allows an iterator to be repeatedly reused. * + * @param <E> the type to iterate over * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface ResettableListIterator extends ListIterator, ResettableIterator { - - /** - * Resets the iterator back to the position at which the iterator - * was created. - */ - public void reset(); +public interface ResettableListIterator<E> extends ListIterator<E>, ResettableIterator<E> { } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBag.java Sat Nov 4 07:21:01 2006 @@ -22,12 +22,13 @@ * Defines a type of <code>Bag</code> that maintains a sorted order among * its unique representative members. * + * @param <E> the type to iterate over * @since Commons Collections 2.0 * @version $Revision$ $Date$ * * @author Chuck Burdick */ -public interface SortedBag extends Bag { +public interface SortedBag<E> extends Bag<E> { /** * Returns the comparator associated with this sorted set, or null @@ -35,20 +36,20 @@ * * @return the comparator in use, or null if natural ordering */ - public Comparator comparator(); + public Comparator<? super E> comparator(); /** * Returns the first (lowest) member. * * @return the first element in the sorted bag */ - public Object first(); + public E first(); /** * Returns the last (highest) member. * * @return the last element in the sorted bag */ - public Object last(); - + public E last(); + } Modified: jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java?view=diff&rev=471214&r1=471213&r2=471214 ============================================================================== --- jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java (original) +++ jakarta/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/SortedBidiMap.java Sat Nov 4 07:21:01 2006 @@ -25,12 +25,14 @@ * Implementations should allow a value to be looked up from a key and * a key to be looked up from a value with equal performance. * + * @param <K> the type of the keys in the map + * @param <V> the type of the values in the map * @since Commons Collections 3.0 * @version $Revision$ $Date$ * * @author Stephen Colebourne */ -public interface SortedBidiMap extends OrderedBidiMap, SortedMap { +public interface SortedBidiMap<K, V> extends OrderedBidiMap<K, V>, SortedMap<K, V> { /** * Gets a view of this map where the keys and values are reversed. @@ -47,8 +49,8 @@ * * @return an inverted bidirectional map */ - public BidiMap inverseBidiMap(); - + public BidiMap<V, K> inverseBidiMap(); + /** * Gets a view of this map where the keys and values are reversed. * <p> @@ -64,6 +66,6 @@ * * @return an inverted bidirectional map */ - public SortedBidiMap inverseSortedBidiMap(); - + public SortedBidiMap<V, K> inverseSortedBidiMap(); + } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]