Udostępnij za pośrednictwem


Collections.ReplaceAll(IList, Object, Object) Method

Definition

Replaces all occurrences of one specified value in a list with another.

[Android.Runtime.Register("replaceAll", "(Ljava/util/List;Ljava/lang/Object;Ljava/lang/Object;)Z", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static bool ReplaceAll (System.Collections.IList list, Java.Lang.Object? oldVal, Java.Lang.Object? newVal);
[<Android.Runtime.Register("replaceAll", "(Ljava/util/List;Ljava/lang/Object;Ljava/lang/Object;)Z", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member ReplaceAll : System.Collections.IList * Java.Lang.Object * Java.Lang.Object -> bool

Parameters

list
IList

the list in which replacement is to occur.

oldVal
Object

the old value to be replaced.

newVal
Object

the new value with which oldVal is to be replaced.

Returns

true if list contained one or more elements e such that (oldVal==null ? e==null : oldVal.equals(e)).

Attributes

Remarks

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.)

Added in 1.4.

Java documentation for java.util.Collections.replaceAll(java.util.List<T>, T, T).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to