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:46:00 UTC
[jira] [Updated] (COLLECTIONS-732) Got an
UnsupportedOperationException when using
MultiValuedMap.MapIterator().setValue()
[ https://issues.apache.org/jira/browse/COLLECTIONS-732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chen updated COLLECTIONS-732:
-----------------------------
Summary: Got an UnsupportedOperationException when using MultiValuedMap.MapIterator().setValue() (was: Got an UnsupportedOperationException when altering MultiValuedMap MapIterator setValue)
> Got an UnsupportedOperationException when using 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
> Priority: Major
>
> 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)