MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / replace

Method replace

src/main/java/com/thealgorithms/sorts/CycleSort.java:83–87  ·  view source on GitHub ↗

Replaces an element in the array with the given item and returns the replaced item. @param The type of elements in the array, which must be comparable @param array The array in which the replacement will occur @param pos The position at which the replacement will occur @param item The item

(final T[] array, final int pos, final T item)

Source from the content-addressed store, hash-verified

81 * @return The replaced item
82 */
83 private <T extends Comparable<T>> T replace(final T[] array, final int pos, final T item) {
84 final T replacedItem = array[pos];
85 array[pos] = item;
86 return replacedItem;
87 }
88}

Callers 6

placeItemMethod · 0.95
generateTestBinaryMethod · 0.80
parseMethod · 0.80
toStringMethod · 0.80
decryptMethod · 0.80
encryptMethod · 0.80

Calls

no outgoing calls

Tested by 1

generateTestBinaryMethod · 0.64