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

Method copySwap

lib/java/util/Arrays.java:2683–2700  ·  view source on GitHub ↗

Copies object from one array to another array with reverse of objects order. Source and destination arrays may be the same. @param src - the source array. @param from - starting position in the source array. @param dst - the destination array. @param to -

(Object[] src, int from, Object[] dst, int to,
            int len)

Source from the content-addressed store, hash-verified

2681 * the number of array elements to be copied.
2682 */
2683 private static void copySwap(Object[] src, int from, Object[] dst, int to,
2684 int len) {
2685 if (src == dst && from + len > to) {
2686 int new_to = to + len - 1;
2687 for (; from < to; from++, new_to--, len--) {
2688 dst[new_to] = src[from];
2689 }
2690 for (; len > 1; from++, new_to--, len -= 2) {
2691 swap(from, new_to, dst);
2692 }
2693
2694 } else {
2695 to = to + len - 1;
2696 for (; len > 0; from++, to--, len--) {
2697 dst[to] = src[from];
2698 }
2699 }
2700 }
2701
2702 /**
2703 * Performs a sort on the given String array. Elements will be re-ordered into

Callers 1

stableStringSortMethod · 0.95

Calls 1

swapMethod · 0.95

Tested by

no test coverage detected