Hi Thomas, > + @SuppressWarnings("unchecked") > public <T> T[] toArray(T[] array) { > final int size = size(); > if (array.length < size) { > - // This is safe, both are type T > array = (T[]) > Array.newInstance(array.getClass().getComponentType(), size); > } > > @@ -466,7 +469,6 @@ public abstract class AbstractMapBag<E> > while (it.hasNext()) { > final E current = it.next(); > for (int index = getCount(current); index > 0; index--) { > - // TODO this is unsafe > array[i++] = (T) current; > } > } >
it is a good practice here commenting why the unchecked warning can be suppressed - it will definitively help also future maintainers :) TIA! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org