Fix raw types

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1023903 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-18 17:00:44 +00:00
parent a68c67c121
commit 4675fcd99f
2 changed files with 7 additions and 6 deletions

View File

@ -508,14 +508,15 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @throws ClassCastException if the stream does not contain the correct objects
*/
@SuppressWarnings("unchecked")
protected void doReadObject(Map map, ObjectInputStream in) throws IOException,
protected void doReadObject(Map<E, MutableInteger> map, ObjectInputStream in) throws IOException,
ClassNotFoundException {
this.map = map;
int entrySize = in.readInt();
for (int i = 0; i < entrySize; i++) {
Object obj = in.readObject();
@SuppressWarnings("unchecked") // This will fail at runtime if the stream is incorrect
E obj = (E) in.readObject();
int count = in.readInt();
map.put(obj, new MutableInteger(count));
size += count;

View File

@ -125,11 +125,11 @@ public class TreeBag<E> extends AbstractMapBag<E> implements SortedBag<E>, Seria
/**
* Read the bag in using a custom routine.
*/
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
Comparator comp = (Comparator) in.readObject();
super.doReadObject(new TreeMap(comp), in);
@SuppressWarnings("unchecked") // This will fail at runtime if the stream is incorrect
Comparator<? super E> comp = (Comparator<? super E>) in.readObject();
super.doReadObject(new TreeMap<E, MutableInteger>(comp), in);
}
}