Replaces all occurrences of one specified value in a list with another.
More formally, replaces with newVal
each element e
in list
such that
(oldVal==null ? e==null : oldVal.equals(e))
.
(This method has no effect on the size of the list.)
<T> | the class of the objects in the list | |
list | the list in which replacement is to occur. | |
oldVal | the old value to be replaced. | |
newVal | the new value with which oldVal is to be
replaced. |
true
if list
contained one or more elements
e
such that
(oldVal==null ? e==null : oldVal.equals(e))
.
UnsupportedOperationException | if the specified list or
its list-iterator does not support the set operation. |
Diagram: Collections