Just remove these and let AbstractCollection's implementations stand.
WARNING: behavior change! May cause runtime errors! - Previously these methods would always return an Integer[], which is incorrect. The toArray() version should always return an Object[], and the toArray(T[] a) version should return an array of the same type as that passed in, even if a supertype of T (like Object[]). - The toArray(T[] a) version was not doing any size checking, nor doing any of the required steps if the size doesn't match. This change may break something, but it brings this class into compliance with the Collection interface. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2652 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -255,24 +255,6 @@ public class ArrayIntSet extends AbstractIntSet
|
||||
return values;
|
||||
}
|
||||
|
||||
@Override // from AbstractSet<Integer>
|
||||
public Object[] toArray ()
|
||||
{
|
||||
// TODO: this is wrong. We should be creating an Object[]
|
||||
return toArray(new Integer[_size]);
|
||||
}
|
||||
|
||||
// from AbstractSet<Integer>
|
||||
public Integer[] toArray (Integer[] a)
|
||||
{
|
||||
// TODO: this is wrong. We need to be able to grow the array if necessary
|
||||
// and null-terminate the values if the array is too large
|
||||
for (int i = 0; i < _size; i++) {
|
||||
a[i] = Integer.valueOf(_values[i]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
@Override // from AbstractSet<Integer>
|
||||
public int size ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user