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

Method copySwap

Ports/CLDC11/src/java/util/Arrays.java:3093–3110  ·  view source on GitHub ↗
(Object[] src, int from, Object[] dst, int to,
            int len)

Source from the content-addressed store, hash-verified

3091 /// - `len`: @param len -
3092 /// the number of array elements to be copied.
3093 private static void copySwap(Object[] src, int from, Object[] dst, int to,
3094 int len) {
3095 if (src == dst && from + len > to) {
3096 int new_to = to + len - 1;
3097 for (; from < to; from++, new_to--, len--) {
3098 dst[new_to] = src[from];
3099 }
3100 for (; len > 1; from++, new_to--, len -= 2) {
3101 swap(from, new_to, dst);
3102 }
3103
3104 } else {
3105 to = to + len - 1;
3106 for (; len > 0; from++, to--, len--) {
3107 dst[to] = src[from];
3108 }
3109 }
3110 }
3111
3112 /// Performs a sort on the given String array. Elements will be re-ordered into
3113 /// ascending order.

Callers 1

stableStringSortMethod · 0.95

Calls 1

swapMethod · 0.95

Tested by

no test coverage detected