[ 
https://issues.apache.org/jira/browse/COLLECTIONS-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17018537#comment-17018537
 ] 

Bruno P. Kinoshita commented on COLLECTIONS-732:
------------------------------------------------

Just had another look [~Guoping1] , and tested calling super.setValue, and used 
your code. It still failed, not with an exception, but an assertion error. 
Maybe one of the structures created was not made to be mutated during 
iteration, or even mutated at all, not sure. But anyway, IMO, a Javadoc could 
be added right away, instead of using the inherited javadoc. Would you be 
interested in submitting a PR? Thanks

> 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<String, String> listMap = new 
> ArrayListValuedHashMap<>();
>         List<String> listA = listMap.get("A");
>         listA.addAll(0, Arrays.asList("W", "X", "F"));
>         List<String> listB = listMap.get("B");
>         listB.addAll(0, Arrays.asList("Q", "Q", "L"));
>         assertEquals("{A=[W, X, F], B=[Q, Q, L]}", listMap.toString());
>         for(MapIterator<String, String> iterator = listMap.mapIterator(); 
> iterator.hasNext(); ){
>             iterator.next();
>             String value = iterator.getValue();
>             if(value == "F"){
>                 iterator.setValue("B");
>             }
>         }
>         assertEquals("{A=[W, X, B], B=[Q, Q, L]}", listMap.toString());
>     }
> {code}
> It throws an UnsupportedOperationException when altering 
> mapIterator().setValue()。
> I found UnsupportedOperationException is thrown in the code of setValue。So,if 
> setValue method is not supported,the Javadoc should comment it。



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to