MCPcopy Create free account
hub / github.com/davidgiven/luje / replaceAll

Method replaceAll

lib/java/util/Collections.java:2023–2032  ·  view source on GitHub ↗

Replaces all occurrences of Object obj in list with newObj. If the obj is null, then all occurrences of null are replaced with newObj. @param list the list to modify. @param obj the object to find and replace occurrences

(List<T> list, T obj, T obj2)

Source from the content-addressed store, hash-verified

2021 * if the list does not support setting elements.
2022 */
2023 public static <T> boolean replaceAll(List<T> list, T obj, T obj2) {
2024 int index;
2025 boolean found = false;
2026
2027 while ((index = list.indexOf(obj)) > -1) {
2028 found = true;
2029 list.set(index, obj2);
2030 }
2031 return found;
2032 }
2033
2034 /**
2035 * Rotates the elements in {@code list} by the distance {@code dist}

Callers

nothing calls this directly

Calls 2

indexOfMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected