Top Constructors Methods
com.vladsch.flexmark.util.misc

public Class ArrayUtils

extends Object
Class Inheritance
Imports
org.jetbrains.annotations.NotNull, .Nullable, java.lang.reflect.Array, java.util.BitSet, .Objects, java.util.function.Predicate

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> T[]
append(Class<T> elemClass, T[] array, T... values)

public static <T> boolean
contained(T value, T[] array)

public static boolean
contained(int value, int[] array)

public static <T> T
firstOf(T[] ts, Predicate<? super T> predicate)

public static <T> T
firstOf(T[] ts, int fromIndex, Predicate<? super T> predicate)

public static <T> T
firstOf(T[] ts, int fromIndex, int endIndex, Predicate<? super T> predicate)

public static <T> int
indexOf(T t, T[] ts)

public static <T> int
indexOf(T t, T[] ts, int fromIndex)

public static <T> int
indexOf(T t, T[] ts, int fromIndex, int endIndex)

public static <T> int
indexOf(T[] ts, Predicate<? super T> predicate)

public static <T> int
indexOf(T[] ts, int fromIndex, Predicate<? super T> predicate)

public static <
type of array
T
>
int

Returns:

the index of the next occurrence of a match in the array which is greater than or equal to fromIndex, or -1 if match does not occur after that point.
indexOf
(T[]
array
ts
,
int
the start index from which search in the array. There is no restriction on the value of fromIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.
fromIndex
,
int
the end index of the array, ie. treat as if array.length was endIndex. There is no restriction on the value of endIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to length of this array. If it is negative, it has the same effect as if it were 0: -1 is returned.
endIndex
,
Predicate<? super T>
condition for matching the search
predicate
)

public static <T> int
lastIndexOf(T t, T[] ts)

public static <T> int
lastIndexOf(T t, T[] ts, int fromIndex)

public static <T> int
lastIndexOf(T t, T[] ts, int startIndex, int fromIndex)

public static <T> int
lastIndexOf(T[] ts, Predicate<? super T> predicate)

public static <T> int
lastIndexOf(T[] ts, int fromIndex, Predicate<? super T> predicate)

public static <
type of array
T
>
int

Returns:

the index of the last occurrence of a match in the array which is less than or equal to fromIndex, or -1 if match does not occur before that point.
lastIndexOf
(T[]
array
ts
,
int
the minimum index to search in the array. There is no restriction on the value of startIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.
startIndex
,
int
the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to one less than the length of this array: this entire array may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned.
fromIndex
,
Predicate<? super T>
condition for matching the search
predicate
)

public static <T> T
lastOf(T[] ts, Predicate<? super T> predicate)

public static <T> T
lastOf(T[] ts, int fromIndex, Predicate<? super T> predicate)

public static <T> T
lastOf(T[] ts, int startIndex, int fromIndex, Predicate<? super T> predicate)

public static int[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ArrayUtilsback to summary
public ArrayUtils()

Method Detail

appendback to summary
public static <T> T[] append(Class<T> elemClass, T[] array, T... values)
Annotations
@SafeVarargs
containedback to summary
public static <T> boolean contained(T value, T[] array)
containedback to summary
public static boolean contained(int value, int[] array)
firstOfback to summary
public static <T> T firstOf(T[] ts, Predicate<? super T> predicate)
firstOfback to summary
public static <T> T firstOf(T[] ts, int fromIndex, Predicate<? super T> predicate)
firstOfback to summary
public static <T> T firstOf(T[] ts, int fromIndex, int endIndex, Predicate<? super T> predicate)
Annotations
@Nullable
indexOfback to summary
public static <T> int indexOf(T t, T[] ts)
indexOfback to summary
public static <T> int indexOf(T t, T[] ts, int fromIndex)
indexOfback to summary
public static <T> int indexOf(T t, T[] ts, int fromIndex, int endIndex)
indexOfback to summary
public static <T> int indexOf(T[] ts, Predicate<? super T> predicate)
indexOfback to summary
public static <T> int indexOf(T[] ts, int fromIndex, Predicate<? super T> predicate)
indexOfback to summary
public static <T> int indexOf(T[] ts, int fromIndex, int endIndex, Predicate<? super T> predicate)
Parameters
<T>
type of array
ts:T[]

array

fromIndex:int

the start index from which search in the array. There is no restriction on the value of fromIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.

endIndex:int

the end index of the array, ie. treat as if array.length was endIndex. There is no restriction on the value of endIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to length of this array. If it is negative, it has the same effect as if it were 0: -1 is returned.

predicate:Predicate<? super T>

condition for matching the search

Returns:int

the index of the next occurrence of a match in the array which is greater than or equal to fromIndex, or -1 if match does not occur after that point.

lastIndexOfback to summary
public static <T> int lastIndexOf(T t, T[] ts)
lastIndexOfback to summary
public static <T> int lastIndexOf(T t, T[] ts, int fromIndex)
lastIndexOfback to summary
public static <T> int lastIndexOf(T t, T[] ts, int startIndex, int fromIndex)
lastIndexOfback to summary
public static <T> int lastIndexOf(T[] ts, Predicate<? super T> predicate)
lastIndexOfback to summary
public static <T> int lastIndexOf(T[] ts, int fromIndex, Predicate<? super T> predicate)
lastIndexOfback to summary
public static <T> int lastIndexOf(T[] ts, int startIndex, int fromIndex, Predicate<? super T> predicate)
Parameters
<T>
type of array
ts:T[]

array

startIndex:int

the minimum index to search in the array. There is no restriction on the value of startIndex. If it is less than 0, it has the same effect as if it were 0. If it is greater or equal to length of the array, -1 is returned.

fromIndex:int

the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this array, it has the same effect as if it were equal to one less than the length of this array: this entire array may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned.

predicate:Predicate<? super T>

condition for matching the search

Returns:int

the index of the last occurrence of a match in the array which is less than or equal to fromIndex, or -1 if match does not occur before that point.

lastOfback to summary
public static <T> T lastOf(T[] ts, Predicate<? super T> predicate)
lastOfback to summary
public static <T> T lastOf(T[] ts, int fromIndex, Predicate<? super T> predicate)
lastOfback to summary
public static <T> T lastOf(T[] ts, int startIndex, int fromIndex, Predicate<? super T> predicate)
toArrayback to summary
public static int[] toArray(@NotNull BitSet bitSet)