MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / copySwap

Method copySwap

vm/JavaAPI/src/java/util/Arrays.java:2920–2937  ·  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

2918 * the number of array elements to be copied.
2919 */
2920 private static void copySwap(Object[] src, int from, Object[] dst, int to,
2921 int len) {
2922 if (src == dst && from + len > to) {
2923 int new_to = to + len - 1;
2924 for (; from < to; from++, new_to--, len--) {
2925 dst[new_to] = src[from];
2926 }
2927 for (; len > 1; from++, new_to--, len -= 2) {
2928 swap(from, new_to, dst);
2929 }
2930
2931 } else {
2932 to = to + len - 1;
2933 for (; len > 0; from++, to--, len--) {
2934 dst[to] = src[from];
2935 }
2936 }
2937 }
2938
2939 /**
2940 * 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