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

com.nimbusds.jose.util.ArrayUtils Maven / Gradle / Ivy

Go to download

Java library for Javascript Object Signing and Encryption (JOSE) and JSON Web Tokens (JWT)

There is a newer version: 10.0.1
Show newest version
package com.nimbusds.jose.util;


import java.util.Arrays;


/**
 * Array utilities.
 */
public class ArrayUtils {
	
	
	/**
	 * Concatenates the specified arrays.
	 *
	 * @param first The first array. Must not be {@code null}.
	 * @param rest  The remaining arrays.
	 * @param    The array type.
	 *
	 * @return The resulting array.
	 */
	public static  T[] concat(final T[] first, final T[]... rest) {
		int totalLength = first.length;
		for (T[] array : rest) {
			totalLength += array.length;
		}
		T[] result = Arrays.copyOf(first, totalLength);
		int offset = first.length;
		for (T[] array : rest) {
			System.arraycopy(array, 0, result, offset, array.length);
			offset += array.length;
		}
		return result;
	}
	
	
	/**
	 * Prevents public instantiation.
	 */
	private ArrayUtils() {
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy