All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xs4j.util.ArraysUtil Maven / Gradle / Ivy

Go to download

An attempt to port parsing capabilities offered by Groovy XMLSlurper into the Java world. The following is not planned to be accurate projection, instead the most useful functions will be implemented.

The newest version!
package org.xs4j.util;

/**
 * Created by mturski on 1/8/2017.
 */
public final class ArraysUtil {
    private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; // follows MAX_ARRAY_SIZE from java.util.ArrayList
    private static final int HALF_MAX_ARRAY_SIZE = MAX_ARRAY_SIZE >> 1;

    public static final int safelyDoubleLengthValue(int length) {
        return length < HALF_MAX_ARRAY_SIZE ? length << 1 : MAX_ARRAY_SIZE;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy