avoid some generic array classcastexceptions
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@825140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c5a64eec4
commit
d1eecac1f6
|
@ -46,9 +46,13 @@ public abstract class AbstractTestSortedBidiMap<K extends Comparable<K>, V exten
|
||||||
protected List<V> sortedValues = new ArrayList<V>();
|
protected List<V> sortedValues = new ArrayList<V>();
|
||||||
protected SortedSet<V> sortedNewValues = new TreeSet<V>();
|
protected SortedSet<V> sortedNewValues = new TreeSet<V>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public AbstractTestSortedBidiMap(String testName) {
|
public AbstractTestSortedBidiMap(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
sortedKeys.addAll(Arrays.asList(getSampleKeys()));
|
Object[] sampleKeys = getSampleKeys();
|
||||||
|
for (Object key : sampleKeys) {
|
||||||
|
sortedKeys.add((K) key);
|
||||||
|
}
|
||||||
Collections.sort(sortedKeys);
|
Collections.sort(sortedKeys);
|
||||||
sortedKeys = Collections.unmodifiableList(sortedKeys);
|
sortedKeys = Collections.unmodifiableList(sortedKeys);
|
||||||
|
|
||||||
|
@ -58,7 +62,10 @@ public abstract class AbstractTestSortedBidiMap<K extends Comparable<K>, V exten
|
||||||
sortedValues.addAll(map.values());
|
sortedValues.addAll(map.values());
|
||||||
sortedValues = Collections.unmodifiableList(sortedValues);
|
sortedValues = Collections.unmodifiableList(sortedValues);
|
||||||
|
|
||||||
sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
|
Object[] newSampleValues = getNewSampleValues();
|
||||||
|
for (Object value : newSampleValues) {
|
||||||
|
sortedNewValues.add((V) value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public AbstractTestSortedBidiMap() {
|
// public AbstractTestSortedBidiMap() {
|
||||||
|
|
Loading…
Reference in New Issue