You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Chen (Jira)" <ji...@apache.org> on 2019/11/05 12:37:00 UTC
[jira] [Created] (COLLECTIONS-732) Appeared
UnsupportedOperationException when altering MultiValuedMap MapIterator
setValue
Chen created COLLECTIONS-732:
--------------------------------
Summary: Appeared UnsupportedOperationException when altering MultiValuedMap MapIterator setValue
Key: COLLECTIONS-732
URL: https://issues.apache.org/jira/browse/COLLECTIONS-732
Project: Commons Collections
Issue Type: Bug
Components: Map
Reporter: Chen
copy from https://issues.apache.org/jira/browse/COLLECTIONS-663
{code:java}
public void testSetValueMapIterator(){
final ListValuedMap<K, V> listMap = makeObject();
List<V> listA = listMap.get((K) "A");
listA.addAll(0, Arrays.asList((V) "W", (V) "X", (V) "F"));
List<V> listB = listMap.get((K) "B");
listB.addAll(0, Arrays.asList((V) "Q", (V) "Q", (V) "L"));
assertEquals("{A=[W, X, F], B=[Q, Q, L]}", listMap.toString()); for(MapIterator<K, V> iterator = listMap.mapIterator(); iterator.hasNext(); ){
iterator.next();
V value = iterator.getValue();
if(value == "F"){
iterator.setValue((V) "B");
}
}
assertEquals("{A=[W, X, B], B=[Q, Q, L]}", listMap.toString());
}
{code}
The test throws a UnsupportedOperationException when altering mapIterato setValue。
The issue is that the code throws UnsupportedOperationException in setValue。So,if setValue method is not supported,the Javadoc should comment。
--
This message was sent by Atlassian Jira
(v8.3.4#803005)