Changes:
- Added: RandomGenerator support (Java17), though requires self compilation - Added: Optimizations for HashUtils next power of function. - Added: toArray() now returns a cached empty array if the collection is empty. - Added: toArray function for AsyncBuilder - Updated: SCG to version 1.2.2
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package speiger.src.collections.PACKAGE.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
#if JAVA_VERSION>=17
|
||||
import java.util.random.RANDOM;
|
||||
#else
|
||||
import java.util.RANDOM;
|
||||
#endif
|
||||
import java.util.concurrent.RecursiveAction;
|
||||
#if !TYPE_OBJECT
|
||||
|
||||
@@ -292,7 +296,7 @@ public class ARRAYS
|
||||
* @ArrayType(T)
|
||||
* @return the provided sorted array
|
||||
*/
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, Random random) {
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, RANDOM random) {
|
||||
for(int i = array.length-1; i>=0;i--) {
|
||||
int p = random.nextInt(i + 1);
|
||||
KEY_TYPE t = array[i];
|
||||
@@ -310,7 +314,7 @@ public class ARRAYS
|
||||
* @ArrayType(T)
|
||||
* @return the provided sorted array
|
||||
*/
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, int length, Random random) {
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, int length, RANDOM random) {
|
||||
return shuffle(array, 0, length, random);
|
||||
}
|
||||
|
||||
@@ -323,7 +327,7 @@ public class ARRAYS
|
||||
* @ArrayType(T)
|
||||
* @return the provided sorted array
|
||||
*/
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, int offset, int length, Random random) {
|
||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, int offset, int length, RANDOM random) {
|
||||
for(int i = length-1; i>=0;i--) {
|
||||
int p = offset + random.nextInt(i + 1);
|
||||
KEY_TYPE t = array[offset+i];
|
||||
|
||||
Reference in New Issue
Block a user