Some type parameter clarification.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2348 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -36,8 +36,8 @@ import static com.samskivert.Log.log;
|
||||
* functionality (which we'd just extend directly if those pig fuckers hadn't
|
||||
* made the instance variables private).
|
||||
*/
|
||||
public abstract class BaseArrayList<T> extends AbstractList<T>
|
||||
implements List<T>, RandomAccess, Cloneable, Serializable
|
||||
public abstract class BaseArrayList<E> extends AbstractList<E>
|
||||
implements List<E>, RandomAccess, Cloneable, Serializable
|
||||
{
|
||||
// documentation inherited from interface
|
||||
public int size ()
|
||||
@@ -88,9 +88,9 @@ public abstract class BaseArrayList<T> extends AbstractList<T>
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // documentation inherited from interface
|
||||
public boolean add (T o)
|
||||
public boolean add (E o)
|
||||
{
|
||||
_elements = (T[])ListUtil.add(_elements, _size, o);
|
||||
_elements = (E[])ListUtil.add(_elements, _size, o);
|
||||
_size++;
|
||||
return true;
|
||||
}
|
||||
@@ -106,34 +106,34 @@ public abstract class BaseArrayList<T> extends AbstractList<T>
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public T get (int index)
|
||||
public E get (int index)
|
||||
{
|
||||
rangeCheck(index, false);
|
||||
return _elements[index];
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public T set (int index, T element)
|
||||
public E set (int index, E element)
|
||||
{
|
||||
rangeCheck(index, false);
|
||||
T old = _elements[index];
|
||||
E old = _elements[index];
|
||||
_elements[index] = element;
|
||||
return old;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // documentation inherited from interface
|
||||
public void add (int index, T element)
|
||||
public void add (int index, E element)
|
||||
{
|
||||
rangeCheck(index, true);
|
||||
_elements = (T[])ListUtil.insert(_elements, index, element);
|
||||
_elements = (E[])ListUtil.insert(_elements, index, element);
|
||||
_size++;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // documentation inherited from interface
|
||||
public T remove (int index)
|
||||
public E remove (int index)
|
||||
{
|
||||
rangeCheck(index, false);
|
||||
T oval = (T)ListUtil.remove(_elements, index);
|
||||
E oval = (E)ListUtil.remove(_elements, index);
|
||||
_size--;
|
||||
return oval;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public abstract class BaseArrayList<T> extends AbstractList<T>
|
||||
public Object clone ()
|
||||
{
|
||||
try {
|
||||
BaseArrayList<T> dup = (BaseArrayList<T>)super.clone();
|
||||
BaseArrayList<E> dup = (BaseArrayList<E>)super.clone();
|
||||
if (_elements != null) {
|
||||
dup._elements = _elements.clone();
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public abstract class BaseArrayList<T> extends AbstractList<T>
|
||||
}
|
||||
|
||||
/** The array of elements in our list. */
|
||||
protected T[] _elements;
|
||||
protected E[] _elements;
|
||||
|
||||
/** The number of elements in our list. */
|
||||
protected int _size;
|
||||
|
||||
@@ -365,12 +365,12 @@ public class Collections
|
||||
* default access and pointlessly preventing people from properly
|
||||
* reusing their code. Yay!
|
||||
*/
|
||||
protected static class SynchronizedSet<T>
|
||||
extends SynchronizedCollection<T> implements Set<T> {
|
||||
SynchronizedSet(Set<T> s) {
|
||||
protected static class SynchronizedSet<E>
|
||||
extends SynchronizedCollection<E> implements Set<E> {
|
||||
SynchronizedSet(Set<E> s) {
|
||||
super(s);
|
||||
}
|
||||
SynchronizedSet(Set<T> s, Object mutex) {
|
||||
SynchronizedSet(Set<E> s, Object mutex) {
|
||||
super(s, mutex);
|
||||
}
|
||||
|
||||
@@ -426,18 +426,18 @@ public class Collections
|
||||
* default access and pointlessly preventing people from properly
|
||||
* reusing their code. Yay!
|
||||
*/
|
||||
protected static class SynchronizedCollection<T>
|
||||
implements Collection<T> {
|
||||
Collection<T> c; // Backing Collection
|
||||
protected static class SynchronizedCollection<E>
|
||||
implements Collection<E> {
|
||||
Collection<E> c; // Backing Collection
|
||||
Object mutex; // Object on which to synchronize
|
||||
|
||||
SynchronizedCollection(Collection<T> c) {
|
||||
SynchronizedCollection(Collection<E> c) {
|
||||
if (c==null)
|
||||
throw new NullPointerException();
|
||||
this.c = c;
|
||||
mutex = this;
|
||||
}
|
||||
SynchronizedCollection(Collection<T> c, Object mutex) {
|
||||
SynchronizedCollection(Collection<E> c, Object mutex) {
|
||||
this.c = c;
|
||||
this.mutex = mutex;
|
||||
}
|
||||
@@ -458,11 +458,11 @@ public class Collections
|
||||
synchronized(mutex) {return c.toArray(a);}
|
||||
}
|
||||
|
||||
public Iterator<T> iterator() {
|
||||
public Iterator<E> iterator() {
|
||||
return c.iterator(); // Must be manually synched by user!
|
||||
}
|
||||
|
||||
public boolean add(T o) {
|
||||
public boolean add(E o) {
|
||||
synchronized(mutex) {return c.add(o);}
|
||||
}
|
||||
public boolean remove(Object o) {
|
||||
@@ -472,7 +472,7 @@ public class Collections
|
||||
public boolean containsAll(Collection<?> coll) {
|
||||
synchronized(mutex) {return c.containsAll(coll);}
|
||||
}
|
||||
public boolean addAll(Collection<? extends T> coll) {
|
||||
public boolean addAll(Collection<? extends E> coll) {
|
||||
synchronized(mutex) {return c.addAll(coll);}
|
||||
}
|
||||
public boolean removeAll(Collection<?> coll) {
|
||||
|
||||
@@ -191,26 +191,26 @@ public class CountHashMap<K> extends HashMap<K, int[]>
|
||||
protected Map.Entry<K, int[]> _entry;
|
||||
}
|
||||
|
||||
protected class CountEntrySet<K>
|
||||
extends AbstractSet<Entry<K>>
|
||||
protected class CountEntrySet<E>
|
||||
extends AbstractSet<Entry<E>>
|
||||
{
|
||||
public CountEntrySet (Set<Map.Entry<K,int[]>> superset)
|
||||
public CountEntrySet (Set<Map.Entry<E,int[]>> superset)
|
||||
{
|
||||
_superset = superset;
|
||||
}
|
||||
|
||||
public Iterator<Entry<K>> iterator ()
|
||||
public Iterator<Entry<E>> iterator ()
|
||||
{
|
||||
final Iterator<Map.Entry<K, int[]>> itr = _superset.iterator();
|
||||
return new Iterator<Entry<K>>() {
|
||||
final Iterator<Map.Entry<E, int[]>> itr = _superset.iterator();
|
||||
return new Iterator<Entry<E>>() {
|
||||
public boolean hasNext ()
|
||||
{
|
||||
return itr.hasNext();
|
||||
}
|
||||
|
||||
public Entry<K> next ()
|
||||
public Entry<E> next ()
|
||||
{
|
||||
return new CountEntryImpl<K>(itr.next());
|
||||
return new CountEntryImpl<E>(itr.next());
|
||||
}
|
||||
|
||||
public void remove ()
|
||||
@@ -240,6 +240,6 @@ public class CountHashMap<K> extends HashMap<K, int[]>
|
||||
CountHashMap.this.clear();
|
||||
}
|
||||
|
||||
protected Set<Map.Entry<K,int[]>> _superset;
|
||||
protected Set<Map.Entry<E,int[]>> _superset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user