public final class ArrayFill extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean[] |
fill(boolean[] a,
boolean val)
Fills and returns the given array, assigning the given
boolean value to each element of the array. |
static byte[] |
fill(byte[] a,
byte val)
Fills and returns the given array, assigning the given
byte value to each element of the array. |
static char[] |
fill(char[] a,
char val)
Fills and returns the given array, assigning the given
char value to each element of the array. |
static double[] |
fill(double[] a,
double val)
Fills and returns the given array, assigning the given
double value to each element of the array. |
static float[] |
fill(float[] a,
float val)
Fills and returns the given array, assigning the given
float value to each element of the array. |
static int[] |
fill(int[] a,
int val)
Fills and returns the given array, assigning the given
int value to each element of the array. |
static long[] |
fill(long[] a,
long val)
Fills and returns the given array, assigning the given
long value to each element of the array. |
static short[] |
fill(short[] a,
short val)
Fills and returns the given array, assigning the given
short value to each element of the array. |
static <T,E extends Throwable> |
fill(T[] array,
FailableIntFunction<? extends T,E> generator)
Fills and returns the given array, using the provided generator supplier to compute each element.
|
static <T> T[] |
fill(T[] a,
T val)
Fills and returns the given array, assigning the given
T value to each element of the array. |
public static boolean[] fill(boolean[] a,
boolean val)
boolean value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(boolean[],boolean)public static byte[] fill(byte[] a,
byte val)
byte value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(byte[],byte)public static char[] fill(char[] a,
char val)
char value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(char[],char)public static double[] fill(double[] a,
double val)
double value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(double[],double)public static float[] fill(float[] a,
float val)
float value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(float[],float)public static int[] fill(int[] a,
int val)
int value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(int[],int)public static long[] fill(long[] a,
long val)
long value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(long[],long)public static short[] fill(short[] a,
short val)
short value to each element of the array.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(short[],short)public static <T,E extends Throwable> T[] fill(T[] array, FailableIntFunction<? extends T,E> generator) throws E extends Throwable
Arrays.setAll(Object[], IntFunction) with exception support.
If the generator supplier throws an exception, it is relayed to the caller and the array is left in an indeterminate state.
T - type of elements of the array.E - The kind of thrown exception or error.array - array to be initialized.generator - a function accepting an index and producing the desired value for that position.E - Thrown by the given generator.E extends ThrowableArrays.setAll(Object[], IntFunction)public static <T> T[] fill(T[] a,
T val)
T value to each element of the array.T - the array type.a - the array to be filled (may be null).val - the value to be stored in all elements of the array.Arrays.fill(Object[],Object)Copyright © 2001–2025 The Apache Software Foundation. All rights reserved.