[
https://issues.apache.org/jira/browse/COLLECTIONS-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17002582#comment-17002582
]
Chen commented on COLLECTIONS-732:
----------------------------------
[~Guoping1]
> 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)