Class N
Note: This class includes codes copied from Apache Commons Lang, Google Guava and other open source projects under the Apache License 2.0. The methods copied from other libraries/frameworks/projects may be modified in this class.
ClassN
is a general java utility class. It provides the most daily used operations for Object/primitive types/String/Array/Collection/Map/Bean...:
When to throw exception? It's designed to avoid throwing any unnecessary exception if the contract defined by method is not broken. for example, if user tries to reverse a
null
or empty String. the input String will be
returned. But exception will be thrown if try to add element to a null
Object array or collection.
An empty String/Array/Collection/Map/Iterator/Iterable/InputStream/Reader will always be a preferred choice than a
null
for the return value of a method.
There are only
fromIndex/startIndex
and {toIndex/endIndex} parameters in the methods defined in class CommonUtil/N
, no offset/count
parameters.
- Version:
- $Revision: 0.8 $ 07/03/10
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigDecimal[]
An empty immutable/unmodifiableBigDecimal
array.static final BigInteger[]
An empty immutable/unmodifiableBigInteger
array.static final boolean[]
An empty immutable/unmodifiableboolean
array.static final Boolean[]
An empty immutable/unmodifiableBoolean
array.static final byte[]
An empty immutable/unmodifiablebyte
array.static final Byte[]
An empty immutable/unmodifiableByte
array.static final Calendar[]
/** An empty immutable/unmodifiableCalendar
array.static final char[]
An empty immutable/unmodifiablechar
array.static final Character[]
An empty immutable/unmodifiableCharacter
array.static final Date[]
An empty immutable/unmodifiablejava.sql.Date
array.static final double[]
An empty immutable/unmodifiabledouble
array.static final Double[]
An empty immutable/unmodifiableDouble
array.static final float[]
An empty immutable/unmodifiablefloat
array.static final Float[]
An empty immutable/unmodifiableFloat
array.static final int[]
An empty immutable/unmodifiableint
array.static final Integer[]
An empty immutable/unmodifiableInteger
array.static final Date[]
An empty immutable/unmodifiablejava.util.Date
array.static final LocalDate[]
/** An empty immutable/unmodifiableLocalDate
array.static final LocalDateTime[]
/** An empty immutable/unmodifiableLocalDateTime
array.static final LocalTime[]
/** An empty immutable/unmodifiableLocalTime
array.static final long[]
An empty immutable/unmodifiablelong
array.static final Long[]
An empty immutable/unmodifiableLong
array.static final Object[]
An empty immutable/unmodifiableObject
array.static final short[]
An empty immutable/unmodifiableshort
array.static final Short[]
An empty immutable/unmodifiableShort
array.static final String[]
An empty immutable/unmodifiableString
array.static final Time[]
An empty immutable/unmodifiableTime
array.static final Timestamp[]
An empty immutable/unmodifiableTimestamp
array.static final int
The index value when an element is not found in a list or array:-1
. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean[]
add
(boolean[] a, boolean elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static byte[]
add
(byte[] a, byte elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static char[]
add
(char[] a, char elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static double[]
add
(double[] a, double elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static float[]
add
(float[] a, float elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static int[]
add
(int[] a, int elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static long[]
add
(long[] a, long elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static short[]
add
(short[] a, short elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static String[]
Returns a new array with elements copied from the specified array and the specified element added at the end.static <T> T[]
add
(T[] a, T elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static boolean[]
addAll
(boolean[] a, boolean... elementsToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static byte[]
addAll
(byte[] a, byte... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static char[]
addAll
(char[] a, char... elementsToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static double[]
addAll
(double[] a, double... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static float[]
addAll
(float[] a, float... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static int[]
addAll
(int[] a, int... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static long[]
addAll
(long[] a, long... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static short[]
addAll
(short[] a, short... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static String[]
Returns a new array with elements copied from the specified array and the specified elements added at the end.static <T> boolean
addAll
(Collection<T> c, Iterable<? extends T> elementsToAdd) Adds all the elements in elementsToAdd to a given collection.static <T> boolean
addAll
(Collection<T> c, Iterator<? extends T> elementsToAdd) Adds all the elements in elementsToAdd to a given collection.static <T> boolean
addAll
(Collection<T> c, T... elementsToAdd) Adds all the elements in elementsToAdd to a given collection.static <T> T[]
addAll
(T[] a, T... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static boolean
allBlank
(CharSequence... css) Checks if all of the CharSequences are empty (""),null
or whitespace only.static boolean
allBlank
(CharSequence a, CharSequence b) static boolean
allBlank
(CharSequence a, CharSequence b, CharSequence c) static boolean
allBlank
(Collection<? extends CharSequence> css) static <A,
B> boolean allEmpty
(A[] a, B[] b) static <A,
B, C> boolean allEmpty
(A[] a, B[] b, C[] c) static boolean
allEmpty
(CharSequence... css) Checks if all of the CharSequences are empty ("") ornull
.static boolean
allEmpty
(CharSequence a, CharSequence b) static boolean
allEmpty
(CharSequence a, CharSequence b, CharSequence c) static boolean
allEmpty
(Collection<?> a, Collection<?> b) static boolean
allEmpty
(Collection<?> a, Collection<?> b, Collection<?> c) static boolean
allEmpty
(Collection<? extends CharSequence> css) static boolean
allFalse
(boolean[] a) static <T> boolean
static <T> boolean
static <T> boolean
static <A,
B> boolean allNull
(A a, B b) static <A,
B, C> boolean allNull
(A a, B b, C c) static boolean
allNull
(Collection<?> c) static <T> boolean
allNull
(T... a) static boolean
allTrue
(boolean[] a) static boolean
anyBlank
(CharSequence... css) Checks if any of the CharSequences are empty ("") ornull
or whitespace only.static boolean
anyBlank
(CharSequence a, CharSequence b) static boolean
anyBlank
(CharSequence a, CharSequence b, CharSequence c) static boolean
anyBlank
(Collection<? extends CharSequence> css) static <A,
B> boolean anyEmpty
(A[] a, B[] b) static <A,
B, C> boolean anyEmpty
(A[] a, B[] b, C[] c) static boolean
anyEmpty
(CharSequence... css) Checks if any of the CharSequences are empty ("") ornull
.static boolean
anyEmpty
(CharSequence a, CharSequence b) static boolean
anyEmpty
(CharSequence a, CharSequence b, CharSequence c) static boolean
anyEmpty
(Collection<?> a, Collection<?> b) static boolean
anyEmpty
(Collection<?> a, Collection<?> b, Collection<?> c) static boolean
anyEmpty
(Collection<? extends CharSequence> css) static boolean
anyFalse
(boolean[] a) static <T> boolean
static <T> boolean
static <T> boolean
static <A,
B> boolean anyNull
(A a, B b) static <A,
B, C> boolean anyNull
(A a, B b, C c) static boolean
anyNull
(Collection<?> c) static <T> boolean
anyNull
(T... a) static boolean
anyTrue
(boolean[] a) static <T,
E extends Exception>
voidapplyToEach
(List<T> c, Throwables.Function<? super T, ? extends T, E> converter) Updates each element in the specified List with specified functionconverter
.static <T,
E extends Exception>
voidapplyToEach
(T[] a, Throwables.Function<? super T, ? extends T, E> converter) Updates each element in the specified array with specified functionconverter
.static <T> T[]
asArray
(T... a) The input array is returned.static <T> ArrayBlockingQueue
<T> asArrayBlockingQueue
(T... a) Returns a modifiableArrayBlockingQueue
with specified elements.static <T> ArrayDeque
<T> asArrayDeque
(T... a) Returns a modifiableArrayDeque
with specified elements.static <T> ConcurrentLinkedDeque
<T> asConcurrentLinkedDeque
(T... a) Returns a modifiableConcurrentLinkedDeque
with specified elements.static <T> ConcurrentLinkedQueue
<T> asConcurrentLinkedQueue
(T... a) Returns a modifiableConcurrentLinkedQueue
with specified elements.static <T extends Delayed>
DelayQueue<T> asDelayQueue
(T... a) Returns a modifiableDelayQueue
with specified elements.static <T> Deque
<T> asDeque
(T... a) Returns a modifiableDeque
with specified elements.static <T> LinkedBlockingDeque
<T> asLinkedBlockingDeque
(T... a) Returns a modifiableLinkedBlockingDeque
with specified elements.static <T> LinkedBlockingQueue
<T> asLinkedBlockingQueue
(T... a) Returns a modifiableLinkedBlockingQueue
with specified elements.static <K,
V> Map <K, V> asLinkedHashMap
(Object... a) Deprecated.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2, K k3, V v3) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableLinkedHashMap
with specified keys/values.static <K,
V> Map <K, V> asLinkedHashMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableLinkedHashMap
with specified keys/values.static <T> Set
<T> asLinkedHashSet
(T e) Returns a modifiableLinkedHashSet
with specified element.static <T> Set
<T> asLinkedHashSet
(T... a) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2, T e3) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2, T e3, T e4) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2, T e3, T e4, T e5) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableLinkedHashSet
with specified elements.static <T> Set
<T> asLinkedHashSet
(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableLinkedHashSet
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e) Returns a modifiableLinkedList
with specified element.static <T> LinkedList
<T> asLinkedList
(T... a) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2, T e3) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2, T e3, T e4) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2, T e3, T e4, T e5) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableLinkedList
with specified elements.static <T> LinkedList
<T> asLinkedList
(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableLinkedList
with specified elements.static <T> List
<T> asList
(T e) Returns a modifiableList
with specified element.static <T> List
<T> asList
(T... a) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4, T e5) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8) Returns a modifiableList
with specified elements.static <T> List
<T> asList
(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9) Returns a modifiableList
with specified elements.static <K,
V> Map <K, V> Deprecated.static <K,
V> Map <K, V> asMap
(K k1, V v1) Returns a modifiableMap
with specified key/value.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2) Returns a modifiableMap
with specified keys/values.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2, K k3, V v3) Returns a modifiableMap
with specified keys/values.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns a modifiableMap
with specified keys/values.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableMap
with specified keys/values.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableMap
with specified keys/values.static <K,
V> Map <K, V> asMap
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableMap
with specified keys/values.static <T> Multiset
<T> asMultiset
(T... a) Returns a modifiableMultiset
with specified elements.static <T> NavigableSet
<T> asNavigableSet
(T... a) Returns a modifiableNavigableSet
with specified elements.static <T> PriorityQueue
<T> asPriorityQueue
(T... a) Returns a modifiablePriorityQueue
with specified elements.Deprecated.Returns a modifiableMap
with specified key/value.Returns a modifiableMap
with specified keys/values.asProps
(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3) Returns a modifiableMap
with specified keys/values.asProps
(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4) Returns a modifiableMap
with specified keys/values.asProps
(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4, String propName5, Object propValue5) Returns a modifiableMap
with specified keys/values.static <T> Queue
<T> asQueue
(T... a) Returns a modifiableQueue
with specified elements.static <T> Set
<T> asSet
(T e) Returns a modifiableSet
with specified element.static <T> Set
<T> asSet
(T... a) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4, T e5) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8) Returns a modifiableSet
with specified elements.static <T> Set
<T> asSet
(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9) Returns a modifiableSet
with specified elements.static <T> List
<T> asSingletonList
(T o) Wrap the specified value with a singleton list.static <K,
V> Map <K, V> asSingletonMap
(K key, V value) Wrap the specified key/value with a singleton map.static <T> Set
<T> asSingletonSet
(T o) Wrap the specified value with a singleton set.static <T> SortedSet
<T> asSortedSet
(T... a) Returns a modifiableSortedSet
with specified elements.static <R> ObjIterator
<R> asynCall
(Collection<? extends Callable<? extends R>> commands) Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily.static <R> ObjIterator
<R> asynCall
(Collection<? extends Callable<? extends R>> commands, Executor executor) Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily.static ContinuableFuture
<Void> asyncExecute
(Throwables.Runnable<? extends Exception> command) Executes the provided command asynchronously.static ContinuableFuture
<Void> asyncExecute
(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillisInMillis, Predicate<? super Exception> retryCondition) Executes a Runnable task asynchronously with the possibility of retrying in case of failure.static ContinuableFuture
<Void> asyncExecute
(Throwables.Runnable<? extends Exception> command, long delayInMillis) Executes the provided command asynchronously after a specified delay.static ContinuableFuture
<Void> asyncExecute
(Throwables.Runnable<? extends Exception> command, Executor executor) static <R> List
<ContinuableFuture<R>> asyncExecute
(Collection<? extends Callable<R>> commands) static <R> List
<ContinuableFuture<R>> asyncExecute
(Collection<? extends Callable<R>> commands, Executor executor) static <R> ContinuableFuture
<R> asyncExecute
(Callable<R> command) Executes the provided command asynchronously.static <R> ContinuableFuture
<R> asyncExecute
(Callable<R> cmd, int retryTimes, long retryIntervallInMillisInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes a Runnable task asynchronously with the possibility of retrying in case of failure.static <R> ContinuableFuture
<R> asyncExecute
(Callable<R> command, long delayInMillis) Executes the provided command asynchronously after a specified delay.static <R> ContinuableFuture
<R> asyncExecute
(Callable<R> command, Executor executor) static List
<ContinuableFuture<Void>> asyncExecute
(List<? extends Throwables.Runnable<? extends Exception>> commands) static List
<ContinuableFuture<Void>> asyncExecute
(List<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) static ObjIterator
<Void> asynRun
(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily.static ObjIterator
<Void> asynRun
(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily.static double
average
(byte... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(byte[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(char... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(char[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(double... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(double[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(float... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(float[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(int... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(int[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(long... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(long[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(short... a) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static double
average
(short[] a, int fromIndex, int toIndex) Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.static BigDecimal
averageBigDecimal
(Iterable<? extends BigDecimal> c) Calculates the average of an Array/Collection.static <T> BigDecimal
averageBigDecimal
(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Calculates the average of an Array/Collection.static BigDecimal
averageBigInteger
(Iterable<? extends BigInteger> c) Calculates the average of an Array/Collection.static <T> BigDecimal
averageBigInteger
(Iterable<? extends T> c, Function<? super T, BigInteger> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageDouble
(Iterable<? extends T> c) Calculates the average of an Array/Collection.static <T> double
averageDouble
(Iterable<? extends T> c, ToDoubleFunction<? super T> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageDouble
(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageDouble
(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T extends Number>
doubleaverageDouble
(T[] a) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageDouble
(T[] a, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageDouble
(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T> double
averageDouble
(T[] a, ToDoubleFunction<? super T> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageInt
(Iterable<? extends T> c) Calculates the average of an Array/Collection.static <T> double
averageInt
(Iterable<? extends T> c, ToIntFunction<? super T> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageInt
(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageInt
(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T extends Number>
doubleaverageInt
(T[] a) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageInt
(T[] a, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageInt
(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T> double
averageInt
(T[] a, ToIntFunction<? super T> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageLong
(Iterable<? extends T> c) Calculates the average of an Array/Collection.static <T> double
averageLong
(Iterable<? extends T> c, ToLongFunction<? super T> func) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageLong
(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageLong
(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T extends Number>
doubleaverageLong
(T[] a) Calculates the average of an Array/Collection.static <T extends Number>
doubleaverageLong
(T[] a, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.static <T> double
averageLong
(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) Calculates the average of an Array/Collection within the specified range.static <T> double
averageLong
(T[] a, ToLongFunction<? super T> func) Calculates the average of an Array/Collection.static int
binarySearch
(byte[] a, byte valueToFind) static int
binarySearch
(byte[] a, int fromIndex, int toIndex, byte valueToFind) static int
binarySearch
(char[] a, char valueToFind) static int
binarySearch
(char[] a, int fromIndex, int toIndex, char valueToFind) static int
binarySearch
(double[] a, double valueToFind) static int
binarySearch
(double[] a, int fromIndex, int toIndex, double valueToFind) static int
binarySearch
(float[] a, float valueToFind) static int
binarySearch
(float[] a, int fromIndex, int toIndex, float valueToFind) static int
binarySearch
(int[] a, int valueToFind) static int
binarySearch
(int[] a, int fromIndex, int toIndex, int valueToFind) static int
binarySearch
(long[] a, int fromIndex, int toIndex, long valueToFind) static int
binarySearch
(long[] a, long valueToFind) static int
binarySearch
(short[] a, int fromIndex, int toIndex, short valueToFind) static int
binarySearch
(short[] a, short valueToFind) static int
binarySearch
(Object[] a, int fromIndex, int toIndex, Object valueToFind) static int
binarySearch
(Object[] a, Object valueToFind) static <T extends Comparable<? super T>>
intbinarySearch
(List<? extends T> list, int fromIndex, int toIndex, T valueToFind) static <T> int
binarySearch
(List<? extends T> list, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
intbinarySearch
(List<? extends T> list, T valueToFind) static <T> int
binarySearch
(List<? extends T> list, T valueToFind, Comparator<? super T> cmp) static <T> int
binarySearch
(T[] a, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) static <T> int
binarySearch
(T[] a, T valueToFind, Comparator<? super T> cmp) callByBatch
(Iterable<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes a given function on batches of elements from the providediterable
.callByBatch
(Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes a given consumer on each element from the providediterable
in batches, then executes a batch action after each batch.callByBatch
(Iterator<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes a given function on batches of elements from the provided iterator.callByBatch
(Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes a given consumer on each element from the provided iterator in batches, then executes a batch action after each batch.callByBatch
(T[] a, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes a given function on batches of elements from the provided array.callByBatch
(T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes a given consumer on batches of elements from the provided array, then executes a batch action after each batch.static <R> List
<R> callInParallel
(Collection<? extends Callable<? extends R>> commands) Executes and complete the input commands in parallel.static <R> List
<R> callInParallel
(Collection<? extends Callable<? extends R>> commands, Executor executor) Executes and complete the input commands in parallel.static <R,
R2> Tuple.Tuple2 <R, R2> callInParallel
(Callable<R> command, Callable<R2> command2) Executes and complete the input commands in parallel.static <R,
R2, R3>
Tuple.Tuple3<R, R2, R3> callInParallel
(Callable<R> command, Callable<R2> command2, Callable<R3> command3) Executes and complete the input commands in parallel.static <R,
R2, R3, R4>
Tuple.Tuple4<R, R2, R3, R4> callInParallel
(Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4) Executes and complete the input commands in parallel.static <R,
R2, R3, R4, R5>
Tuple.Tuple5<R, R2, R3, R4, R5> callInParallel
(Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4, Callable<R5> command5) Executes and complete the input commands in parallel.static <T> T
callUninterruptibly
(long timeoutInMillis, Throwables.LongFunction<? extends T, InterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> T
callUninterruptibly
(long timeout, TimeUnit unit, Throwables.BiFunction<Long, TimeUnit, T, InterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> T
Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> u.Nullable
<T> castIfAssignable
(Object val, com.landawn.abacus.type.Type<? extends T> targetType) Casts the given object to the specified target type if possible using the provided Type instance.static <T> u.Nullable
<T> castIfAssignable
(Object val, Class<? extends T> targetType) Casts the given object to the specified target type if possible.static <T extends CharSequence>
TcheckArgNotBlank
(T arg, String msg) Checks if a CharSequence is NOTnull
, empty ("") or whitespace only.static boolean[]
checkArgNotEmpty
(boolean[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static byte[]
checkArgNotEmpty
(byte[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static char[]
checkArgNotEmpty
(char[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static double[]
checkArgNotEmpty
(double[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static float[]
checkArgNotEmpty
(float[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static int[]
checkArgNotEmpty
(int[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static long[]
checkArgNotEmpty
(long[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static short[]
checkArgNotEmpty
(short[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static <T> Multiset
<T> checkArgNotEmpty
(Multiset<T> arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static <T> T[]
checkArgNotEmpty
(T[] arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static <T extends CharSequence>
TcheckArgNotEmpty
(T arg, String argNameOrErrorMsg) Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.static byte
checkArgNotNegative
(byte arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static double
checkArgNotNegative
(double arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static float
checkArgNotNegative
(float arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static int
checkArgNotNegative
(int arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static long
checkArgNotNegative
(long arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static short
checkArgNotNegative
(short arg, String argNameOrErrorMsg) Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.static <T> T
checkArgNotNull
(T obj) Check arg notnull
.static <T> T
checkArgNotNull
(T obj, String errorMessage) Check arg notnull
.static byte
checkArgPositive
(byte arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static double
checkArgPositive
(double arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static float
checkArgPositive
(float arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static int
checkArgPositive
(int arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static long
checkArgPositive
(long arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static short
checkArgPositive
(short arg, String argNameOrErrorMsg) Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.static void
checkArgument
(boolean expression) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean expression, String errorMessage) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, boolean p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, boolean p1, boolean p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, boolean p1, boolean p2, boolean p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, byte p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, char p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, double p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, double p1, double p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, double p1, double p2, double p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, float p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, float p1, float p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, float p1, float p2, float p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, int p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, int p1, int p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, int p1, int p2, int p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, long p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, long p1, long p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, long p1, long p2, long p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, short p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, Object p) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, Object p1, Object p2) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) Ensures the truth of an expression involving one or more parameters to the calling method.static void
checkArgument
(boolean b, Supplier<String> errorMessageSupplier) static void
Check if the specifiedArray
contains anynull
element.static void
checkElementNotNull
(Object[] a, String argNameOrErrorMsg) Check if the specifiedArray
contains anynull
element.static void
Check if the specifiedCollection
contains anynull
element.static void
checkElementNotNull
(Collection<?> c, String argNameOrErrorMsg) Check if the specifiedCollection
contains anynull
element.static void
checkFromIndexSize
(int fromIndex, int size, int length) Check from index size.static void
checkFromToIndex
(int fromIndex, int toIndex, int length) Check from to index.static void
checkIndex
(int index, int length) static void
checkKeyNotNull
(Map<?, ?> m) Check if the specifiedMap
contains anynull
key.static void
checkKeyNotNull
(Map<?, ?> m, String argNameOrErrorMsg) Check if the specifiedMap
contains anynull
key.static void
checkState
(boolean expression) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean expression, String errorMessage) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, double p) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, double p1, double p2) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, double p1, double p2, double p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, float p) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, float p1, float p2) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, float p1, float p2, float p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, int p) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, int p1, int p2) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, int p1, int p2, int p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, long p) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, long p1, long p2) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, long p1, long p2, long p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, Object p) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, Object p1, Object p2) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static void
checkState
(boolean b, Supplier<String> errorMessageSupplier) static void
checkValueNotNull
(Map<?, ?> m) Check if the specifiedMap
contains anynull
value.static void
checkValueNotNull
(Map<?, ?> m, String argNameOrErrorMsg) Check if the specifiedMap
contains anynull
value.static boolean[]
clone
(boolean[] original) Clone the original array.static boolean[][]
clone
(boolean[][] original) Clone the original array and its sub arrays.static boolean[][][]
clone
(boolean[][][] original) Clone the original array and its sub arrays.static byte[]
clone
(byte[] original) Clone the original array.static byte[][]
clone
(byte[][] original) Clone the original array and its sub arrays.static byte[][][]
clone
(byte[][][] original) Clone the original array and its sub arrays.static char[]
clone
(char[] original) Clone the original array.static char[][]
clone
(char[][] original) Clone the original array and its sub arrays.static char[][][]
clone
(char[][][] original) Clone the original array and its sub arrays.static double[]
clone
(double[] original) Clone the original array.static double[][]
clone
(double[][] original) Clone the original array and its sub arrays.static double[][][]
clone
(double[][][] original) Clone the original array and its sub arrays.static float[]
clone
(float[] original) Clone the original array.static float[][]
clone
(float[][] original) Clone the original array and its sub arrays.static float[][][]
clone
(float[][][] original) Clone the original array and its sub arrays.static int[]
clone
(int[] original) Clone the original array.static int[][]
clone
(int[][] original) Clone the original array and its sub arrays.static int[][][]
clone
(int[][][] original) Clone the original array and its sub arrays.static long[]
clone
(long[] original) Clone the original array.static long[][]
clone
(long[][] original) Clone the original array and its sub arrays.static long[][][]
clone
(long[][][] original) Clone the original array and its sub arrays.static short[]
clone
(short[] original) Clone the original array.static short[][]
clone
(short[][] original) Clone the original array and its sub arrays.static short[][][]
clone
(short[][][] original) Clone the original array and its sub arrays.static <T> T
Deeply copy by: obj -> serialize -> kryo/Json -> deserialize -> new object.static <T> T
clone
(T obj) Clones the given object.static <T> T[]
clone
(T[] original) Clone the original array.static <T> T[][]
clone
(T[][] original) Clone the original array and its sub arrays.static <T> T[][][]
clone
(T[][][] original) Clone the original array and its sub arrays.static <T> Set
<T> commonSet
(Collection<? extends Collection<? extends T>> c) Returns a Set containing the common elements of the given collections.static <T> Set
<T> commonSet
(Collection<? extends T> a, Collection<?> b) Returns a Set containing the common elements of two given collections.static int
compare
(boolean[] a, boolean[] b) Compares two arrays lexicographically.static int
compare
(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(boolean a, boolean b) static int
compare
(byte[] a, byte[] b) Compares two arrays lexicographically.static int
compare
(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(byte a, byte b) static int
compare
(char[] a, char[] b) Compares two arrays lexicographically.static int
compare
(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(double[] a, double[] b) Compares two arrays lexicographically.static int
compare
(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(double a, double b) static int
compare
(float[] a, float[] b) Compares two arrays lexicographically.static int
compare
(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(float a, float b) static int
compare
(int[] a, int[] b) Compares two arrays lexicographically.static int
compare
(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(int a, int b) static int
compare
(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(long[] a, long[] b) Compares two arrays lexicographically.static int
compare
(long a, long b) static int
compare
(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static int
compare
(short[] a, short[] b) Compares two arrays lexicographically.static int
compare
(short a, short b) static <T extends Comparable<? super T>>
intCompares two iterables lexicographically.static <T> int
compare
(Iterable<T> a, Iterable<T> b, Comparator<? super T> cmp) Compares two iterables using the specified comparator.static <T> int
compare
(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) Compares two collections lexicographically over the specified range.static <T> int
compare
(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) Compares two collections lexicographically over the specified range using the specified comparator.static <T extends Comparable<? super T>>
intCompares two iterators lexicographically.static <T> int
compare
(Iterator<T> a, Iterator<T> b, Comparator<? super T> cmp) Compares two iterators using the specified comparator.static <T extends Comparable<? super T>>
intcompare
(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static <T> int
compare
(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) Compares two arrays lexicographically over the specified range using the specified comparator.static <T extends Comparable<? super T>>
intcompare
(T[] a, T[] b) Compares two arrays lexicographically.static <T> int
compare
(T[] a, T[] b, Comparator<? super T> cmp) Compares two arrays using the specified comparator.static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2) Continue to compare the pairs of values(a1, b1), (a2, b2)
until they're not equal.static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>, T3 extends Comparable<T3>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3) Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3)
until they're not equal.static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4) Deprecated.static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5) Deprecated.please useBuilder.ComparisonBuilder
static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6) Deprecated.please useBuilder.ComparisonBuilder
static <T1 extends Comparable<T1>,
T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>, T7 extends Comparable<T7>>
intcompare
(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6, T7 a7, T7 b7) Deprecated.please useBuilder.ComparisonBuilder
static <T extends Comparable<? super T>>
intcompare
(T a, T b) static <T> int
compare
(T a, T b, Comparator<? super T> cmp) Returns 0 if the arguments are identical andc.compare(a, b)
otherwise.static int
compareByProps
(Object bean1, Object bean2, Collection<String> propNamesToCompare) Deprecated.callgetPropValue
by reflection apis during comparing or sorting may have huge impact to performance.static int
compareIgnoreCase
(String[] a, String[] b) Compares two arrays of strings lexicographically, ignoring case differences.static int
compareIgnoreCase
(String a, String b) Compares two strings lexicographically, ignoring case differences.static int
compareUnsigned
(byte[] a, byte[] b) Compares two arrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(byte a, byte b) static int
compareUnsigned
(int[] a, int[] b) Compares two arrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(int a, int b) static int
compareUnsigned
(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(long[] a, long[] b) Compares two arrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(long a, long b) static int
compareUnsigned
(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(short[] a, short[] b) Compares two arrays lexicographically, treating the values as unsigned.static int
compareUnsigned
(short a, short b) static boolean[]
concat
(boolean[]... aa) Concatenates multiple boolean arrays into a new array.static boolean[]
concat
(boolean[] a, boolean[] b) Concatenates two boolean arrays into a new array.static byte[]
concat
(byte[]... aa) Concatenates multiple byte arrays into a new array.static byte[]
concat
(byte[] a, byte[] b) Concatenates two byte arrays into a new array.static char[]
concat
(char[]... aa) Concatenates multiple char arrays into a new array.static char[]
concat
(char[] a, char[] b) Concatenates two char arrays into a new array.static double[]
concat
(double[]... aa) Concatenates multiple double arrays into a new array.static double[]
concat
(double[] a, double[] b) Concatenates two double arrays into a new array.static float[]
concat
(float[]... aa) Concatenates multiple float arrays into a new array.static float[]
concat
(float[] a, float[] b) Concatenates two float arrays into a new array.static int[]
concat
(int[]... aa) Concatenates multiple int arrays into a new array.static int[]
concat
(int[] a, int[] b) Concatenates two int arrays into a new array.static long[]
concat
(long[]... aa) Concatenates multiple long arrays into a new array.static long[]
concat
(long[] a, long[] b) Concatenates two long arrays into a new array.static short[]
concat
(short[]... aa) Concatenates multiple short arrays into a new array.static short[]
concat
(short[] a, short[] b) Concatenates two short arrays into a new array.static <T> List
<T> Concatenates multiple iterables into a new list.static <T> List
<T> Concatenates two iterables into a new list.static <T> List
<T> concat
(Collection<? extends Iterable<? extends T>> c) Concatenates multiple iterables into a new list.static <T,
C extends Collection<T>>
Cconcat
(Collection<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Concatenates multiple iterables into a new collection.static <T> ObjIterator
<T> Concatenates multiple iterators into a new ObjIterator.static <T> ObjIterator
<T> Concatenates two iterators into a new ObjIterator.static <T> T[]
concat
(T[]... aa) Concatenates multiple arrays into a new array.static <T> T[]
concat
(T[] a, T[] b) Concatenates two arrays into a new array.static boolean
contains
(boolean[] a, boolean valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(byte[] a, byte valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(char[] a, char valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(double[] a, double valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(float[] a, float valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(int[] a, int valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(long[] a, long valueToFind) Checks if the specified array contains the specified value.static boolean
contains
(short[] a, short valueToFind) Checks if the specified array contains the specified value.static boolean
Checks if the specifiedIterable
contains the specified value.static boolean
Checks if the specified array contains the specified value.static boolean
contains
(Collection<?> c, Object valueToFind) Checks if the specified Collection contains the specified value.static boolean
Checks if the specified Iterator contains the specified value.static boolean
containsAll
(Iterable<?> c, Collection<?> valuesToFind) Checks if the specifiedIterable
contains all the elements in the specifiedvaluesToFind
Collection.static boolean
containsAll
(Collection<?> c, Object... valuesToFind) Checks if the specified Collection contains all the elements in the specifiedvaluesToFind
array.static boolean
containsAll
(Collection<?> c, Collection<?> valuesToFind) Checks if the specified Collection contains all the elements in the specifiedvaluesToFind
Collection.static boolean
containsAll
(Iterator<?> iter, Collection<?> valuesToFind) Checks if the specified Iterator contains all the elements in the specifiedvaluesToFind
Collection.static boolean
containsAny
(Iterable<?> c, Set<?> valuesToFind) Checks if the specifiedIterable
contains any elements from the specifiedvaluesToFind
Set.static boolean
containsAny
(Collection<?> c, Object... valuesToFind) Checks if the specified Collection contains any elements from the specifiedvaluesToFind
array.static boolean
containsAny
(Collection<?> c, Collection<?> valuesToFind) Checks if the specified Collection contains any elements from the specifiedvaluesToFind
Collection.static boolean
containsAny
(Iterator<?> iter, Set<?> valuesToFind) Checks if the specified Iterator contains any elements from the specifiedvaluesToFind
Set.static <T> T
Converts the given source object to the specified target type using the provided Type instance.static <T> T
Converts the given source object to the specified target type.static void
copy
(boolean[] src, int srcPos, boolean[] dest, int destPos, int length) static void
copy
(byte[] src, int srcPos, byte[] dest, int destPos, int length) static void
copy
(char[] src, int srcPos, char[] dest, int destPos, int length) static void
copy
(double[] src, int srcPos, double[] dest, int destPos, int length) static void
copy
(float[] src, int srcPos, float[] dest, int destPos, int length) static void
copy
(int[] src, int srcPos, int[] dest, int destPos, int length) static void
copy
(long[] src, int srcPos, long[] dest, int destPos, int length) static void
copy
(short[] src, int srcPos, short[] dest, int destPos, int length) static void
static <T> T
copy
(Object sourceBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean, except the properties specified in theignoredPropNames
set.static void
static <T> T
Returns a new instance of specifiedtargetType
with properties copied from the given source bean.static <T> T
copy
(Object sourceBean, Collection<String> selectPropNames, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean with selected properties.static <T> T
copy
(Object sourceBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean with selected properties.static <T> T
copy
(Object sourceBean, BiPredicate<? super String, ?> propFilter, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean, filtered by the specified predicate.static <T> T
copy
(Object sourceBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean, filtered by the specified predicate.static <T> void
Copies a portion of one list into another.static <T> void
Copies all of the elements from one list into another.static <T> T
copy
(T sourceBean) Returns a copy of the given source bean.static <T> T
copy
(T sourceBean, Collection<String> selectPropNames) Returns a copy of the given source bean with selected properties.static <T> T
copy
(T sourceBean, BiPredicate<? super String, ?> propFilter) Returns a copy of the given source bean with properties filtered by the specified predicate.static boolean[]
copyOf
(boolean[] original, int newLength) static byte[]
copyOf
(byte[] original, int newLength) static char[]
copyOf
(char[] original, int newLength) static double[]
copyOf
(double[] original, int newLength) static float[]
copyOf
(float[] original, int newLength) static int[]
copyOf
(int[] original, int newLength) static long[]
copyOf
(long[] original, int newLength) static short[]
copyOf
(short[] original, int newLength) static <T> T[]
copyOf
(T[] original, int newLength) static <T,
U> T[] static boolean[]
copyOfRange
(boolean[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static boolean[]
copyOfRange
(boolean[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static byte[]
copyOfRange
(byte[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static byte[]
copyOfRange
(byte[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static char[]
copyOfRange
(char[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static char[]
copyOfRange
(char[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static double[]
copyOfRange
(double[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static double[]
copyOfRange
(double[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static float[]
copyOfRange
(float[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static float[]
copyOfRange
(float[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static int[]
copyOfRange
(int[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static int[]
copyOfRange
(int[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static long[]
copyOfRange
(long[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static long[]
copyOfRange
(long[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static short[]
copyOfRange
(short[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static short[]
copyOfRange
(short[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static String
copyOfRange
(String str, int fromIndex, int toIndex) Copy all the chars inoriginal
, throughto
-from
.static String
copyOfRange
(String str, int fromIndex, int toIndex, int step) Copy all the chars inoriginal
, throughto
-from
, bystep
.static <T> List
<T> copyOfRange
(List<T> c, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static <T> List
<T> copyOfRange
(List<T> c, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static <T> T[]
copyOfRange
(T[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.static <T> T[]
copyOfRange
(T[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.static <T> T[]
copyOfRange
(T[] original, int fromIndex, int toIndex, int step, Class<? extends T[]> newType) Copy all the elements inoriginal
, throughto
-from
, bystep
.static <T,
U> T[] copyOfRange
(U[] original, int fromIndex, int toIndex, Class<? extends T[]> newType) static <T,
E extends Exception>
T[]copyThenApplyToEach
(T[] a, Throwables.Function<? super T, ? extends T, E> converter) Copies the specified array first, then applies the provided converter function to each element of the copy.static int
count
(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(boolean[] a, BooleanPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(byte[] a, int fromIndex, int toIndex, BytePredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(byte[] a, BytePredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(char[] a, int fromIndex, int toIndex, CharPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(char[] a, CharPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(double[] a, int fromIndex, int toIndex, DoublePredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(double[] a, DoublePredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(float[] a, int fromIndex, int toIndex, FloatPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(float[] a, FloatPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(int[] a, int fromIndex, int toIndex, IntPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(int[] a, IntPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(long[] a, int fromIndex, int toIndex, LongPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(long[] a, LongPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(short[] a, int fromIndex, int toIndex, ShortPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
count
(short[] a, ShortPredicate filter) Mostly it's designed for one-step operation to complete the operation in one step.static <T> int
Mostly it's designed for one-step operation to complete the operation in one step.static <T> int
count
(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) Mostly it's designed for one-step operation to complete the operation in one step.static int
Counts the number of elements in the given iterator.static <T> int
Counts the number of elements in the given iterator that match the provided predicate.static <T> int
Mostly it's designed for one-step operation to complete the operation in one step.static <T> int
Mostly it's designed for one-step operation to complete the operation in one step.countBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) countBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) static boolean
deepEquals
(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) static boolean
deepEquals
(Object[] a, Object[] b) static boolean
deepEquals
(Object a, Object b) static int
deepHashCode
(Object obj) static int
deepHashCode
(Object[] a) Deep hash code.static int
deepHashCode
(Object[] a, int fromIndex, int toIndex) Deep hash code.static String
deepToString
(Object obj) static String
deepToString
(Object[] a) Deep to string.static String
deepToString
(Object[] a, int fromIndex, int toIndex) Deep to string.static String
deepToString
(Object[] a, String defaultIfNull) Deep to string.static <T extends CharSequence>
TdefaultIfBlank
(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplier
if the specified object is blank or itself if the specified object is not blank.static <T extends CharSequence>
TdefaultIfBlank
(T str, T defaultStr) Returns the specified default value if the specified object is blank or itself if the specified object is not blank.static <T extends CharSequence>
TdefaultIfEmpty
(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplier
if the specified object is empty or itself if the specified object is not empty.static <T extends CharSequence>
TdefaultIfEmpty
(T str, T defaultStr) Returns the specified default value if the specified object is empty or itself if the specified object is not empty.static boolean
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static boolean
defaultIfNull
(Boolean b, boolean defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static byte
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static byte
defaultIfNull
(Byte b, byte defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static char
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static char
defaultIfNull
(Character c, char defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static double
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static double
defaultIfNull
(Double b, double defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static float
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static float
defaultIfNull
(Float b, float defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static int
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static int
defaultIfNull
(Integer b, int defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static long
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static long
defaultIfNull
(Long b, long defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static short
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.static short
defaultIfNull
(Short b, short defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static <T> T
defaultIfNull
(T obj, Supplier<? extends T> supplierForDefault) Returns the default value provided by specifiedSupplier
if the specified object isnull
or itself if the specified object is notnull
.static <T> T
defaultIfNull
(T obj, T defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.static <T> T
defaultValueOf
(Class<T> cls) Returns the default value of the given class type.static boolean[]
deleteAllByIndices
(boolean[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static byte[]
deleteAllByIndices
(byte[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static char[]
deleteAllByIndices
(char[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static double[]
deleteAllByIndices
(double[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static float[]
deleteAllByIndices
(float[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static int[]
deleteAllByIndices
(int[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static long[]
deleteAllByIndices
(long[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static short[]
deleteAllByIndices
(short[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static String[]
deleteAllByIndices
(String[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static boolean
deleteAllByIndices
(List<?> list, int... indices) Removes the elements at the specified positions from the specified List.static <T> T[]
deleteAllByIndices
(T[] a, int... indices) Returns a new array with elements copied from the specified array except the element at the specified positions.static boolean[]
deleteByIndex
(boolean[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static byte[]
deleteByIndex
(byte[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static char[]
deleteByIndex
(char[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static double[]
deleteByIndex
(double[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static float[]
deleteByIndex
(float[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static int[]
deleteByIndex
(int[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static long[]
deleteByIndex
(long[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static short[]
deleteByIndex
(short[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static <T> T[]
deleteByIndex
(T[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static boolean[]
deleteRange
(boolean[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static byte[]
deleteRange
(byte[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static char[]
deleteRange
(char[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static double[]
deleteRange
(double[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static float[]
deleteRange
(float[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static int[]
deleteRange
(int[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static long[]
deleteRange
(long[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static short[]
deleteRange
(short[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static String[]
deleteRange
(String[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static String
deleteRange
(String str, int fromIndex, int toIndex) Returns a new String with the specified range of chars removed
The original String remains unchanged.static <T> boolean
deleteRange
(List<T> c, int fromIndex, int toIndex) Deletes a range of elements from the given list.static <T> T[]
deleteRange
(T[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static boolean[]
difference
(boolean[] a, boolean[] b) Returns all the elements in the specified Array/Collection a but not in b.static byte[]
difference
(byte[] a, byte[] b) Returns all the elements in the specified Array/Collection a but not in b.static char[]
difference
(char[] a, char[] b) Returns all the elements in the specified Array/Collection a but not in b.static double[]
difference
(double[] a, double[] b) Returns all the elements in the specified Array/Collection a but not in b.static float[]
difference
(float[] a, float[] b) Returns all the elements in the specified Array/Collection a but not in b.static int[]
difference
(int[] a, int[] b) Returns all the elements in the specified Array/Collection a but not in b.static long[]
difference
(long[] a, long[] b) Returns all the elements in the specified Array/Collection a but not in b.static short[]
difference
(short[] a, short[] b) Returns all the elements in the specified Array/Collection a but not in b.static <T> List
<T> difference
(Collection<? extends T> a, Collection<?> b) Returns all the elements in the specified Array/Collection a but not in b.static <T> List
<T> difference
(T[] a, Object[] b) Returns all the elements in the specified Array/Collection a but not in b.static boolean
Returnstrue
if the two specified arrays/collections have no elements in common.static boolean
disjoint
(Collection<?> c1, Collection<?> c2) Returnstrue
if the two specified arrays/collections have no elements in common.static boolean[]
distinct
(boolean[] a) Mostly it's designed for one-step operation to complete the operation in one step.static boolean[]
distinct
(boolean[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static byte[]
distinct
(byte[] a) Mostly it's designed for one-step operation to complete the operation in one step.static byte[]
distinct
(byte[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static char[]
distinct
(char[] a) Mostly it's designed for one-step operation to complete the operation in one step.static char[]
distinct
(char[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static double[]
distinct
(double[] a) Mostly it's designed for one-step operation to complete the operation in one step.static double[]
distinct
(double[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static float[]
distinct
(float[] a) Mostly it's designed for one-step operation to complete the operation in one step.static float[]
distinct
(float[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static int[]
distinct
(int[] a) Mostly it's designed for one-step operation to complete the operation in one step.static int[]
distinct
(int[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static long[]
distinct
(long[] a) Mostly it's designed for one-step operation to complete the operation in one step.static long[]
distinct
(long[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static short[]
distinct
(short[] a) Mostly it's designed for one-step operation to complete the operation in one step.static short[]
distinct
(short[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static <T> List
<T> Mostly it's designed for one-step operation to complete the operation in one step.static <T> List
<T> distinct
(Collection<? extends T> c, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static <T> List
<T> static <T> List
<T> distinct
(T[] a) Mostly it's designed for one-step operation to complete the operation in one step.static <T> List
<T> distinct
(T[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.static <T> List
<T> distinctBy
(Iterable<? extends T> c, Function<? super T, ?> keyMapper) Distinct by the value mapped fromkeyMapper
.static <T,
C extends Collection<T>>
CdistinctBy
(Iterable<? extends T> c, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
.static <T> List
<T> distinctBy
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ?> keyMapper) Distinct by the value mapped fromkeyMapper
.static <T> List
<T> distinctBy
(Iterator<? extends T> iter, Function<? super T, ?> keyMapper) Distinct by the value mapped fromkeyMapper
.static <T,
C extends Collection<T>>
CdistinctBy
(Iterator<? extends T> iter, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
.static <T> List
<T> distinctBy
(T[] a, int fromIndex, int toIndex, Function<? super T, ?> keyMapper) Distinct by the value mapped fromkeyMapper
.static <T> List
<T> distinctBy
(T[] a, Function<? super T, ?> keyMapper) Distinct by the value mapped fromkeyMapper
.static <T,
C extends Collection<T>>
CdistinctBy
(T[] a, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
.static <T> List
<T> Returns a list containing the elements of the inputiterable
after dropping the elements that satisfy the provided predicate.static <T> List
<T> Returns a list containing the elements of the input array after dropping the elements that satisfy the provided predicate.static DataSet
Returns an unmodifiable emptyDataSet
.static InputStream
Returns an empty immutable/unmodifiableInputStream
.static <T> Iterator
<T> Returns an empty immutable/unmodifiableIterator
.static <T> List
<T> Returns an empty immutable/unmodifiableList
.static <T> ListIterator
<T> Returns an empty immutable/unmodifiableListIterator
.static <K,
V> Map <K, V> emptyMap()
Returns an empty immutable/unmodifiableMap
.static <K,
V> NavigableMap <K, V> Returns an empty immutable/unmodifiableNavigableMap
.static <T> NavigableSet
<T> Returns an empty immutable/unmodifiableNavigableSet
.static <T> Set
<T> emptySet()
Returns an empty immutable/unmodifiableSet
.static <K,
V> SortedMap <K, V> Returns an empty immutable/unmodifiableSortedMap
.static <T> SortedSet
<T> Returns an empty immutable/unmodifiableSortedSet
.static <E extends Enum<E>>
ImmutableList<E> enumListOf
(Class<E> enumClass) Returns an immutable/unmodifiable list of all the enum constants in the specified enum class.static <E extends Enum<E>>
ImmutableBiMap<E, String> Returns an immutable/unmodifiable bi-directional map of all the enum constants in the specified enum class to their names.static <E extends Enum<E>>
ImmutableSet<E> Returns an immutable/unmodifiable set of all the enum constants in the specified enum class.static boolean
equals
(boolean[] a, boolean[] b) static boolean
equals
(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) static boolean
equals
(boolean a, boolean b) static boolean
equals
(byte[] a, byte[] b) static boolean
equals
(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) static boolean
equals
(byte a, byte b) static boolean
equals
(char[] a, char[] b) static boolean
equals
(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) static boolean
equals
(char a, char b) static boolean
equals
(double[] a, double[] b) static boolean
equals
(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) static boolean
equals
(double a, double b) static boolean
equals
(float[] a, float[] b) static boolean
equals
(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) static boolean
equals
(float a, float b) static boolean
equals
(int[] a, int[] b) static boolean
equals
(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) static boolean
equals
(int a, int b) static boolean
equals
(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) static boolean
equals
(long[] a, long[] b) static boolean
equals
(long a, long b) static boolean
equals
(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) static boolean
equals
(short[] a, short[] b) static boolean
equals
(short a, short b) static boolean
static boolean
static boolean
static boolean
static boolean
equalsByCommonProps
(Object bean1, Object bean2) static boolean
equalsByProps
(Object bean1, Object bean2, Collection<String> propNamesToCompare) static boolean
equalsIgnoreCase
(String[] a, int fromIndexA, String[] b, int fromIndexB, int len) Equals ignore case.static boolean
equalsIgnoreCase
(String[] a, String[] b) Equals ignore case.static boolean
equalsIgnoreCase
(String a, String b) Equals ignore case.static void
Erases the properties of the given bean object.static void
erase
(Object bean, Collection<String> propNames) Erases the properties of the given bean object.static void
Erases all the properties of the given bean object.static <T> List
<T> exclude
(Collection<? extends T> c, Object objToExclude) Returns a newList
with specified objToExclude excluded.static <T> List
<T> excludeAll
(Collection<? extends T> c, Collection<?> objsToExclude) Returns a newList
with specified objsToExclude excluded.static <T> Set
<T> excludeAllToSet
(Collection<? extends T> c, Collection<?> objsToExclude) Returns a newSet
with specified objsToExclude excluded.static <T> Set
<T> excludeToSet
(Collection<? extends T> c, Object objToExclude) Returns a newSet
with specified objToExclude excluded.static void
execute
(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillis, Predicate<? super Exception> retryCondition) Executes a command with the possibility of retrying in case of failure.static <R> R
execute
(Callable<R> cmd, int retryTimes, long retryIntervallInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes a Callable task with the possibility of retrying in case of failure.static void
fill
(boolean[] a, boolean val) static void
fill
(boolean[] a, int fromIndex, int toIndex, boolean val) static void
fill
(byte[] a, byte val) static void
fill
(byte[] a, int fromIndex, int toIndex, byte val) static void
fill
(char[] a, char val) static void
fill
(char[] a, int fromIndex, int toIndex, char val) static void
fill
(double[] a, double val) static void
fill
(double[] a, int fromIndex, int toIndex, double val) static void
fill
(float[] a, float val) static void
fill
(float[] a, int fromIndex, int toIndex, float val) static void
fill
(int[] a, int val) static void
fill
(int[] a, int fromIndex, int toIndex, int val) static void
fill
(long[] a, int fromIndex, int toIndex, long val) static void
fill
(long[] a, long val) static void
fill
(short[] a, int fromIndex, int toIndex, short val) static void
fill
(short[] a, short val) static <T> T
Fill the properties of the bean with random values.static <T> List
<T> Fill the properties of the bean with random values.static void
Fill the properties of the bean with random values.static void
static void
static <T> void
The specified value will be added/inserted into the specified List.static <T> void
static boolean[]
filter
(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) static boolean[]
filter
(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static boolean[]
filter
(boolean[] a, int max, BooleanPredicate filter) static boolean[]
filter
(boolean[] a, BooleanPredicate filter) static byte[]
filter
(byte[] a, int fromIndex, int toIndex, BytePredicate filter) static byte[]
filter
(byte[] a, int fromIndex, int toIndex, BytePredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static byte[]
filter
(byte[] a, BytePredicate filter) static byte[]
filter
(byte[] a, BytePredicate filter, int max) static char[]
filter
(char[] a, int fromIndex, int toIndex, CharPredicate filter) static char[]
filter
(char[] a, int fromIndex, int toIndex, CharPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static char[]
filter
(char[] a, CharPredicate filter) static char[]
filter
(char[] a, CharPredicate filter, int max) static double[]
filter
(double[] a, int fromIndex, int toIndex, DoublePredicate filter) static double[]
filter
(double[] a, int fromIndex, int toIndex, DoublePredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static double[]
filter
(double[] a, DoublePredicate filter) static double[]
filter
(double[] a, DoublePredicate filter, int max) static float[]
filter
(float[] a, int fromIndex, int toIndex, FloatPredicate filter) static float[]
filter
(float[] a, int fromIndex, int toIndex, FloatPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static float[]
filter
(float[] a, FloatPredicate filter) static float[]
filter
(float[] a, FloatPredicate filter, int max) static int[]
filter
(int[] a, int fromIndex, int toIndex, IntPredicate filter) static int[]
filter
(int[] a, int fromIndex, int toIndex, IntPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static int[]
filter
(int[] a, IntPredicate filter) static int[]
filter
(int[] a, IntPredicate filter, int max) static long[]
filter
(long[] a, int fromIndex, int toIndex, LongPredicate filter) static long[]
filter
(long[] a, int fromIndex, int toIndex, LongPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static long[]
filter
(long[] a, LongPredicate filter) static long[]
filter
(long[] a, LongPredicate filter, int max) static short[]
filter
(short[] a, int fromIndex, int toIndex, ShortPredicate filter) static short[]
filter
(short[] a, int fromIndex, int toIndex, ShortPredicate filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.static short[]
filter
(short[] a, ShortPredicate filter) static short[]
filter
(short[] a, ShortPredicate filter, int max) static <T> List
<T> static <T> List
<T> static <T,
C extends Collection<T>>
Cfilter
(Iterable<? extends T> c, Predicate<? super T> filter, int max, IntFunction<C> supplier) static <T,
C extends Collection<T>>
Cfilter
(Iterable<? extends T> c, Predicate<? super T> filter, IntFunction<C> supplier) static <T> List
<T> filter
(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) static <T> List
<T> filter
(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, int max) static <T,
C extends Collection<T>>
Cfilter
(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, int max, IntFunction<C> supplier) static <T,
C extends Collection<T>>
Cfilter
(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) static <T> List
<T> Returns a list of values filtered by the specified predicate.static <T> List
<T> Mostly it's designed for one-step operation to complete the operation in one step.static <T,
C extends Collection<T>>
Cfilter
(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, int max, IntFunction<C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
C extends Collection<T>>
Cfilter
(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.static <T> List
<T> Returns a list of values filtered by the specified predicate.static <T> List
<T> Returns a list of values filtered by the specified predicate.static <T,
C extends Collection<T>>
Cfilter
(T[] a, Predicate<? super T> filter, int max, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.static <T,
C extends Collection<T>>
Cfilter
(T[] a, Predicate<? super T> filter, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.static <T> u.Nullable
<T> static <T> u.Nullable
<T> static <T> u.Nullable
<T> static <T> u.OptionalInt
findFirstIndex
(Collection<? extends T> c, Predicate<? super T> predicate) Find first index.static <T,
U> u.OptionalInt findFirstIndex
(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Find first index.static <T> u.OptionalInt
findFirstIndex
(T[] a, Predicate<? super T> predicate) Find first index.static <T,
U> u.OptionalInt findFirstIndex
(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Find first index.static <T> u.Optional
<T> findFirstNonNull
(Iterable<? extends T> c, Predicate<? super T> predicate) Find first nonnull
.static <T> u.Optional
<T> findFirstNonNull
(Iterator<? extends T> iter, Predicate<? super T> predicate) static <T> u.Optional
<T> findFirstNonNull
(T[] a, Predicate<? super T> predicate) Find first nonnull
.static <T> u.Nullable
<T> static <T> u.Nullable
<T> static <T> u.OptionalInt
findLastIndex
(Collection<? extends T> c, Predicate<? super T> predicate) Find last index.static <T,
U> u.OptionalInt findLastIndex
(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) static <T> u.OptionalInt
findLastIndex
(T[] a, Predicate<? super T> predicate) Find last index.static <T,
U> u.OptionalInt findLastIndex
(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Find last index.static <T> u.Optional
<T> findLastNonNull
(Iterable<? extends T> c, Predicate<? super T> predicate) Find last nonnull
.static <T> u.Optional
<T> findLastNonNull
(T[] a, Predicate<? super T> predicate) Find last nonnull
.static <T> u.Nullable
<T> firstElement
(Iterable<? extends T> c) Returns the first element in the given Iterable wrapped in a Nullable.static <T> u.Nullable
<T> firstElement
(Iterator<? extends T> iter) Returns the first element in the given Iterator wrapped in a Nullable.static <T> List
<T> firstElements
(Iterable<? extends T> c, int n) Returns a list containing the first n elements from the given Iterable.static <T> List
<T> firstElements
(Iterator<? extends T> iter, int n) Returns a list containing the first n elements from the given Iterator.static <K,
V> u.Optional <Map.Entry<K, V>> firstEntry
(Map<K, V> map) static <T extends CharSequence>
u.Optional<T> firstNonBlank
(T... a) static <T extends CharSequence>
u.Optional<T> firstNonBlank
(T a, T b) static <T extends CharSequence>
u.Optional<T> firstNonBlank
(T a, T b, T c) static <T extends CharSequence>
u.Optional<T> firstNonEmpty
(T... a) static <T> u.Optional
<T[]> firstNonEmpty
(T[] a, T[] b) static <T> u.Optional
<T[]> firstNonEmpty
(T[] a, T[] b, T[] c) static <T extends Collection<?>>
u.Optional<T> firstNonEmpty
(T a, T b) static <T extends Collection<?>>
u.Optional<T> firstNonEmpty
(T a, T b, T c) static <T> u.Optional
<T> firstNonNull
(Iterable<? extends T> c) Returns the first non-null value from the provided iterable.static <T> u.Optional
<T> firstNonNull
(Iterator<? extends T> iter) Returns the first non-null value from the provided iterator.static <T> u.Optional
<T> firstNonNull
(T... a) Returns the first non-null value among the provided values.static <T> u.Optional
<T> firstNonNull
(T a, T b) Returns the first non-null value among the two provided values.static <T> u.Optional
<T> firstNonNull
(T a, T b, T c) Returns the first non-null value among the three provided values.static <T> T
firstOrDefaultIfEmpty
(Iterable<? extends T> c, T defaultValueForEmpty) First or default if empty.static <T> T
firstOrDefaultIfEmpty
(Iterator<? extends T> iter, T defaultValueForEmpty) First or default if empty.static <T> T
firstOrDefaultIfEmpty
(T[] a, T defaultValueForEmpty) First or default if empty.static <T> T
firstOrNullIfEmpty
(Iterable<? extends T> c) First ornull
if empty.static <T> T
firstOrNullIfEmpty
(Iterator<? extends T> iter) First ornull
if empty.static <T> T
firstOrNullIfEmpty
(T[] a) First ornull
if empty.static <T,
R> List <R> static <T,
R, C extends Collection<R>>
Cflatmap
(Iterable<? extends T> c, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) static <T,
R> List <R> flatmap
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
Cflatmap
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
Cflatmap
(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> static <T,
R, C extends Collection<R>>
Cflatmap
(T[] a, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) static <T,
R> List <R> flatMap
(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper) static <T,
R, C extends Collection<R>>
CflatMap
(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) static <T,
U, R> List <R> flatMap
(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) static <T,
U, R, C extends Collection<R>>
CflatMap
(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> flatMap
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
CflatMap
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> flatMap
(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
CflatMap
(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> flatMap
(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms an array of elements into a list by applying a given function to each element and flattening the result.static <T,
R, C extends Collection<R>>
CflatMap
(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) static <T,
U, R> List <R> flatMap
(T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) static <T,
U, R, C extends Collection<R>>
CflatMap
(T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static boolean[]
flatten
(boolean[][] a) Flattens a two-dimensional boolean array into a one-dimensional boolean array.static byte[]
flatten
(byte[][] a) Flattens a two-dimensional byte array into a one-dimensional byte array.static char[]
flatten
(char[][] a) Flattens a two-dimensional char array into a one-dimensional char array.static double[]
flatten
(double[][] a) Flattens a two-dimensional double array into a one-dimensional double array.static float[]
flatten
(float[][] a) Flattens a two-dimensional float array into a one-dimensional float array.static int[]
flatten
(int[][] a) Flattens a two-dimensional int array into a one-dimensional int array.static long[]
flatten
(long[][] a) Flattens a two-dimensional long array into a one-dimensional long array.static short[]
flatten
(short[][] a) Flattens a two-dimensional short array into a one-dimensional short array.static <T> List
<T> Flattens anIterable
ofIterable<T>
into a one-dimensional List.static <T,
C extends Collection<T>>
Cflatten
(Iterable<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Flattens anIterable
ofIterable<T>
into a one-dimensional Collection.static <T> ObjIterator
<T> Flattens anIterator
ofIterator<T>
into a one-dimensional Iterator.static <T> T[]
flatten
(T[][] a) Flattens a two-dimensional array into a one-dimensional array.static <T> T[]
Flattens a two-dimensional array into a one-dimensional array.static List
<?> flattenEachElement
(Iterable<?> c) Flattens each element of the providedIterable
if it's anIterable
itself, otherwise just adds it to the result List.static <T,
C extends Collection<T>>
CflattenEachElement
(Iterable<?> c, Supplier<? extends C> supplier) Flattens each element of the providedIterable
if it's anIterable
itself, otherwise just adds it to the result Collection.static <E extends Exception>
voidforEach
(int startInclusive, int endExclusive, int step, Throwables.IntConsumer<E> action) static <E extends Exception>
voidforEach
(int startInclusive, int endExclusive, int step, Throwables.Runnable<E> action) Executes the providedaction
for each value in the range defined bystartInclusive
,endExclusive
andstep
.static <T,
E extends Exception>
voidforEach
(int startInclusive, int endExclusive, int step, T a, Throwables.IntObjConsumer<? super T, E> action) static <E extends Exception>
voidforEach
(int startInclusive, int endExclusive, Throwables.IntConsumer<E> action) static <E extends Exception>
voidforEach
(int startInclusive, int endExclusive, Throwables.Runnable<E> action) Executes the providedaction
for each value in the range defined bystartInclusive
andendExclusive
.static <T,
E extends Exception>
voidforEach
(int startInclusive, int endExclusive, T a, Throwables.IntObjConsumer<? super T, E> action) static <A,
B, E extends Exception>
voidforEach
(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) static <A,
B, C, E extends Exception>
voidforEach
(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <A,
B, C, E extends Exception>
voidforEach
(A[] a, B[] b, C[] c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <A,
B, E extends Exception>
voidforEach
(A[] a, B[] b, Throwables.BiConsumer<? super A, ? super B, E> action) static <T,
E extends Exception>
voidforEach
(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) static <T,
E extends Exception>
voidforEach
(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) static <T,
E extends Exception>
voidforEach
(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) forEach
(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) forEach
(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) static <A,
B, E extends Exception>
voidforEach
(Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) static <A,
B, E extends Exception>
voidforEach
(Iterable<A> a, Iterable<B> b, Throwables.BiConsumer<? super A, ? super B, E> action) static <A,
B, C, E extends Exception>
voidforEach
(Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <A,
B, C, E extends Exception>
voidforEach
(Iterable<A> a, Iterable<B> b, Iterable<C> c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <T,
E extends Exception>
voidforEach
(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
E extends Exception>
voidforEach
(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) static <T,
E extends Exception>
voidforEach
(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) static <T,
E extends Exception>
voidforEach
(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) forEach
(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) forEach
(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) static <A,
B, E extends Exception>
voidforEach
(Iterator<A> a, Iterator<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) static <A,
B, E extends Exception>
voidforEach
(Iterator<A> a, Iterator<B> b, Throwables.BiConsumer<? super A, ? super B, E> action) static <A,
B, C, E extends Exception>
voidforEach
(Iterator<A> a, Iterator<B> b, Iterator<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <A,
B, C, E extends Exception>
voidforEach
(Iterator<A> a, Iterator<B> b, Iterator<C> c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) static <K,
V, E extends Exception>
voidforEach
(Map<K, V> map, Throwables.BiConsumer<? super K, ? super V, E> action) static <K,
V, E extends Exception>
voidforEach
(Map<K, V> map, Throwables.Consumer<? super Map.Entry<K, V>, E> action) static <T,
E extends Exception>
voidforEach
(T[] a, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) static <T,
E extends Exception>
voidforEach
(T[] a, Throwables.Consumer<? super T, E> action) forEach
(T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) forEach
(T[] a, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) static <T,
E extends Exception>
voidforEachIndexed
(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action) static <T,
E extends Exception>
voidforEachIndexed
(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) static <T,
E extends Exception>
voidforEachIndexed
(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) static <T,
E extends Exception>
voidforEachIndexed
(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
E extends Exception>
voidforEachIndexed
(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> action) static <T,
E extends Exception>
voidforEachIndexed
(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) static <T,
E extends Exception>
voidforEachIndexed
(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) static <K,
V, E extends Exception>
voidforEachIndexed
(Map<K, V> map, Throwables.IntBiObjConsumer<? super K, ? super V, E> action) static <K,
V, E extends Exception>
voidforEachIndexed
(Map<K, V> map, Throwables.IntObjConsumer<? super Map.Entry<K, V>, E> action) static <T,
E extends Exception>
voidforEachIndexed
(T[] a, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) static <T,
E extends Exception>
voidforEachIndexed
(T[] a, Throwables.IntObjConsumer<? super T, E> action) static <T,
E extends Exception>
voidforEachNonNull
(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) For each nonnull
.forEachNonNull
(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.forEachNonNull
(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.forEachNonNull
(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.forEachNonNull
(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.static <T,
E extends Exception>
voidforEachNonNull
(T[] a, Throwables.Consumer<? super T, E> action) For each nonnull
.forEachNonNull
(T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.forEachNonNull
(T[] a, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.static <T,
E extends Exception>
voidforEachPair
(Iterable<? extends T> c, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachPair
(Iterable<? extends T> c, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachPair
(Iterator<? extends T> iter, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachPair
(Iterator<? extends T> iter, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachPair
(T[] a, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachPair
(T[] a, Throwables.BiConsumer<? super T, ? super T, E> action) For each pair.static <T,
E extends Exception>
voidforEachTriple
(Iterable<? extends T> c, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static <T,
E extends Exception>
voidforEachTriple
(Iterable<? extends T> c, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static <T,
E extends Exception>
voidforEachTriple
(Iterator<? extends T> iter, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static <T,
E extends Exception>
voidforEachTriple
(Iterator<? extends T> iter, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static <T,
E extends Exception>
voidforEachTriple
(T[] a, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static <T,
E extends Exception>
voidforEachTriple
(T[] a, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) For each triple.static String
formatJson
(String json) static String
formatJson
(String json, JSONSerializationConfig config) static String
formatJson
(String json, JSONSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) static String
formatJson
(String json, JSONSerializationConfig config, Class<?> transferType) static String
formatJson
(String json, com.landawn.abacus.type.Type<?> transferType) static String
formatJson
(String json, Class<?> transferType) static String
static String
formatXml
(String xml, XMLSerializationConfig config) static String
formatXml
(String xml, XMLSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) static String
formatXml
(String xml, XMLSerializationConfig config, Class<?> transferType) static String
static String
static <T> T[]
Prints a formatted string and an array of arguments, following the syntax rules ofString.format(String, Object...)
.static <T> T
fromJson
(File json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(File json, JSONDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T> T
fromJson
(InputStream json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(InputStream json, JSONDeserializationConfig config, Class<? extends T> targetType) static <T> T
fromJson
(InputStream json, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(InputStream json, Class<? extends T> targetType) static <T> T
fromJson
(Reader json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(Reader json, JSONDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T> T
fromJson
(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, Class<? extends T> targetType) static <T> T
fromJson
(String json, int fromIndex, int toIndex, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
static <T> T
fromJson
(String json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromJson
(String json, JSONDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T> T
static <T> T
static <T> T
fromXml
(File xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromXml
(File xml, XMLDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T> T
fromXml
(InputStream xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromXml
(InputStream xml, XMLDeserializationConfig config, Class<? extends T> targetType) static <T> T
fromXml
(InputStream xml, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromXml
(InputStream xml, Class<? extends T> targetType) static <T> T
fromXml
(Reader xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromXml
(Reader xml, XMLDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T> T
fromXml
(String xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) static <T> T
fromXml
(String xml, XMLDeserializationConfig config, Class<? extends T> targetType) static <T> T
static <T> T
static <T extends Comparable<? super T>>
booleangeAndLe
(T value, T min, T max) Returnstrue
ismin <= value <= max
, otherwisefalse
is returned.static <T> boolean
geAndLe
(T value, T min, T max, Comparator<? super T> cmp) Returnstrue
ismin <= value <= max
, otherwisefalse
is returned.static <T extends Comparable<? super T>>
booleangeAndLt
(T value, T min, T max) Returnstrue
ismin <= value < max
, otherwisefalse
is returned.static <T> boolean
geAndLt
(T value, T min, T max, Comparator<? super T> cmp) Returnstrue
ismin <= value < max
, otherwisefalse
is returned.static <T> T
getElement
(Iterable<? extends T> c, int index) Retrieves an element from an Iterable at a specified index.static <T> T
getElement
(Iterator<? extends T> iter, long index) Retrieves an element from an Iterator at a specified index.static <T> u.Nullable
<T> getOnlyElement
(Iterable<? extends T> c) Returns the only element in the given Iterable.static <T> u.Nullable
<T> getOnlyElement
(Iterator<? extends T> iter) Returns the only element in the given Iterator.static ImmutableList
<String> getPropNames
(Class<?> beanClass) Retrieves the property names of the given bean class.getPropNames
(Class<?> beanClass, Set<String> propNameToExclude) Retrieves the property names of the given bean class excluding the specified property names.getPropNames
(Object bean) Retrieves the property names of the given bean object.getPropNames
(Object bean, boolean ignoreNullValue) Retrieves the property names of the given bean object.static <T> T
getPropValue
(Object bean, String propName) Retrieves the value of the specified property from the given bean object.static <T> T
getPropValue
(Object bean, String propName, boolean ignoreUnmatchedProperty) Retrieves the value of the specified property from the given bean object.static <T extends Comparable<? super T>>
booleangreaterEqual
(T a, T b) Returnstrue
isa >= b
, otherwisefalse
is returned.static <T> boolean
greaterEqual
(T a, T b, Comparator<? super T> cmp) Returnstrue
isa >= b
, otherwisefalse
is returned.static <T extends Comparable<? super T>>
booleangreaterThan
(T a, T b) Returnstrue
isa > b
, otherwisefalse
is returned.static <T> boolean
greaterThan
(T a, T b, Comparator<? super T> cmp) Returnstrue
isa > b
, otherwisefalse
is returned.groupBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) groupBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) groupBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) static <T,
K, R> Map <K, R> groupBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) static <T,
K, R, M extends Map<K, R>>
MgroupBy
(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) groupBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) groupBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) groupBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) static <K,
T, R> Map <K, R> groupBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) static <K,
T, R, M extends Map<K, R>>
MgroupBy
(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) groupBy
(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) static <T extends Comparable<? super T>>
booleangtAndLe
(T value, T min, T max) Returnstrue
ismin < value <= max
, otherwisefalse
is returned.static <T> boolean
gtAndLe
(T value, T min, T max, Comparator<? super T> cmp) Returnstrue
ismin < value <= max
, otherwisefalse
is returned.static <T extends Comparable<? super T>>
booleangtAndLt
(T value, T min, T max) Returnstrue
ismin < value < max
, otherwisefalse
is returned.static <T> boolean
gtAndLt
(T value, T min, T max, Comparator<? super T> cmp) Returnstrue
ismin < value < max
, otherwisefalse
is returned.static boolean
hasDuplicates
(boolean[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(byte[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(byte[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(char[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(char[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(double[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(double[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(float[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(float[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(int[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(int[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(long[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(long[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(short[] a) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(short[] a, boolean isSorted) Checks if the given array has duplicate elements.static boolean
hasDuplicates
(Collection<?> c) Checks if the given collection has duplicate elements.static boolean
hasDuplicates
(Collection<?> c, boolean isSorted) Checks if the given collection has duplicate elements.static <T> boolean
hasDuplicates
(T[] a) Checks if the given array has duplicate elements.static <T> boolean
hasDuplicates
(T[] a, boolean isSorted) Checks if the given array has duplicate elements.static int
hashCode
(boolean value) static int
hashCode
(boolean[] a) static int
hashCode
(boolean[] a, int fromIndex, int toIndex) static int
hashCode
(byte value) static int
hashCode
(byte[] a) static int
hashCode
(byte[] a, int fromIndex, int toIndex) static int
hashCode
(char value) static int
hashCode
(char[] a) static int
hashCode
(char[] a, int fromIndex, int toIndex) static int
hashCode
(double value) static int
hashCode
(double[] a) static int
hashCode
(double[] a, int fromIndex, int toIndex) static int
hashCode
(float value) static int
hashCode
(float[] a) static int
hashCode
(float[] a, int fromIndex, int toIndex) static int
hashCode
(int value) static int
hashCode
(int[] a) static int
hashCode
(int[] a, int fromIndex, int toIndex) static int
hashCode
(long value) static int
hashCode
(long[] a) static int
hashCode
(long[] a, int fromIndex, int toIndex) static int
hashCode
(short value) static int
hashCode
(short[] a) static int
hashCode
(short[] a, int fromIndex, int toIndex) static int
static int
static int
static <C extends CharSequence,
E extends Exception>
voidifNotEmpty
(C c, Throwables.Consumer<? super C, E> cmd) Executes the provided action if the givenCharSequence
is not empty.ifNotEmpty
(M m, Throwables.Consumer<? super M, E> cmd) Executes the provided action if the given map is not empty.static <T,
E extends Exception>
voidifNotNull
(T obj, Throwables.Consumer<? super T, E> cmd) ifOrElse
(boolean b, Throwables.Runnable<E1> actionForTrue, Throwables.Runnable<E2> actionForFalse) Executes the provided actions based on the boolean condition.static <R,
E extends Exception>
u.Nullable<R> ifOrEmpty
(boolean b, Throwables.Supplier<R, E> supplier) Returns aNullable
with value got from the specifiedsupplier
if b istrue
, otherwise returns an emptyNullable
if b isfalse
.static int
indexOf
(boolean[] a, boolean valueToFind) static int
indexOf
(boolean[] a, boolean valueToFind, int fromIndex) static int
indexOf
(byte[] a, byte valueToFind) static int
indexOf
(byte[] a, byte valueToFind, int fromIndex) static int
indexOf
(char[] a, char valueToFind) static int
indexOf
(char[] a, char valueToFind, int fromIndex) static int
indexOf
(double[] a, double valueToFind) static int
indexOf
(double[] a, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array.static int
indexOf
(double[] a, double valueToFind, double tolerance, int fromIndex) Finds the index of the given value in the array starting at the given index.static int
indexOf
(double[] a, double valueToFind, int fromIndex) static int
indexOf
(float[] a, float valueToFind) static int
indexOf
(float[] a, float valueToFind, int fromIndex) static int
indexOf
(int[] a, int valueToFind) static int
indexOf
(int[] a, int valueToFind, int fromIndex) static int
indexOf
(long[] a, long valueToFind) static int
indexOf
(long[] a, long valueToFind, int fromIndex) static int
indexOf
(short[] a, short valueToFind) static int
indexOf
(short[] a, short valueToFind, int fromIndex) static int
static int
static int
indexOf
(Collection<?> c, Object valueToFind) static int
indexOf
(Collection<?> c, Object valueToFind, int fromIndex) static int
Returns the index of the first occurrence of the specified value in the given iterator.static int
Returns the index of the first occurrence of the specified value in the given iterator, starting the search from the specified index.static int
indexOfIgnoreCase
(String[] a, String valueToFind) static int
indexOfIgnoreCase
(String[] a, String valueToFind, int fromIndex) static int
indexOfSubList
(List<?> sourceList, List<?> subListToFind) Index of sub list.static int
indexOfSubList
(List<?> sourceList, List<?> subListToFind, int fromIndex) Index of sub list.static int[]
indicesOfAll
(Object[] a, Object valueToFind) static int[]
indicesOfAll
(Object[] a, Object valueToFind, int startIndex) static int[]
indicesOfAll
(Collection<?> c, Object valueToFind) static int[]
indicesOfAll
(Collection<?> c, Object valueToFind, int startIndex) static <T> int[]
indicesOfAll
(Collection<? extends T> c, Predicate<? super T> predicate) static <T> int[]
indicesOfAll
(Collection<? extends T> c, Predicate<? super T> predicate, int fromIndex) static <T> int[]
indicesOfAll
(T[] a, Predicate<? super T> predicate) static <T> int[]
indicesOfAll
(T[] a, Predicate<? super T> predicate, int startIndex) static <T extends Comparable<? super T>>
int[]indicesOfAllMax
(Collection<? extends T> c) static <T> int[]
indicesOfAllMax
(Collection<? extends T> c, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
int[]indicesOfAllMax
(T[] a) static <T> int[]
indicesOfAllMax
(T[] a, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
int[]indicesOfAllMin
(Collection<? extends T> c) static <T> int[]
indicesOfAllMin
(Collection<? extends T> c, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
int[]indicesOfAllMin
(T[] a) static <T> int[]
indicesOfAllMin
(T[] a, Comparator<? super T> cmp) static boolean[]
insert
(boolean[] a, int index, boolean elementToInsert) Inserts a boolean value into a given boolean array at a specified index.static byte[]
insert
(byte[] a, int index, byte elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static char[]
insert
(char[] a, int index, char elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static double[]
insert
(double[] a, int index, double elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static float[]
insert
(float[] a, int index, float elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static int[]
insert
(int[] a, int index, int elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static long[]
insert
(long[] a, int index, long elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static short[]
insert
(short[] a, int index, short elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static String[]
Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static String
Returns a new String with chars copied from the specified String and the specified String inserted at the specified index.static <T> T[]
insert
(T[] a, int index, T elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static boolean[]
insertAll
(boolean[] a, int index, boolean... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static byte[]
insertAll
(byte[] a, int index, byte... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static char[]
insertAll
(char[] a, int index, char... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static double[]
insertAll
(double[] a, int index, double... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static float[]
insertAll
(float[] a, int index, float... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static int[]
insertAll
(int[] a, int index, int... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static long[]
insertAll
(long[] a, int index, long... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static short[]
insertAll
(short[] a, int index, short... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static String[]
Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static <T> boolean
insertAll
(List<T> list, int index, Collection<? extends T> elementsToInsert) Inserts the specified elements at the specified position in the list.static <T> boolean
Inserts the specified elements at the specified position in the list.static <T> T[]
insertAll
(T[] a, int index, T... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static boolean[]
intersection
(boolean[] a, boolean[] b) Returns the elements in the specified Array/Collection a and b.static byte[]
intersection
(byte[] a, byte[] b) Returns the elements in the specified Array/Collection a and b.static char[]
intersection
(char[] a, char[] b) Returns the elements in the specified Array/Collection a and b.static double[]
intersection
(double[] a, double[] b) Returns the elements in the specified Array/Collection a and b.static float[]
intersection
(float[] a, float[] b) Returns the elements in the specified Array/Collection a and b.static int[]
intersection
(int[] a, int[] b) Returns the elements in the specified Array/Collection a and b.static long[]
intersection
(long[] a, long[] b) Returns the elements in the specified Array/Collection a and b.static short[]
intersection
(short[] a, short[] b) Returns the elements in the specified Array/Collection a and b.static <T> List
<T> intersection
(Collection<? extends Collection<? extends T>> c) Returns the elements in all the specified collections.static <T> List
<T> intersection
(Collection<? extends T> a, Collection<?> b) Returns the elements in the specified Array/Collection a and b.static <T> List
<T> intersection
(Collection<? extends T> a, Collection<?> b, boolean ignoreOcurrences) Return only the elements in the first collection that are contained in the specified second collection.static <T> List
<T> intersection
(T[] a, Object[] b) Returns the elements in the specified Array/Collection a and b.static <T extends Comparable<? super T>>
booleanisBetween
(T value, T min, T max) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)
static <T> boolean
isBetween
(T value, T min, T max, Comparator<? super T> cmp) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)
static boolean
isBlank
(CharSequence cs) Checks if the specifiedCharSequence
isnull
or blank.static boolean
isEmpty
(boolean[] a) Checks if isnull
or empty.static boolean
isEmpty
(byte[] a) Checks if isnull
or empty.static boolean
isEmpty
(char[] a) Checks if isnull
or empty.static boolean
isEmpty
(double[] a) Checks if isnull
or empty.static boolean
isEmpty
(float[] a) Checks if isnull
or empty.static boolean
isEmpty
(int[] a) Checks if isnull
or empty.static boolean
isEmpty
(long[] a) Checks if isnull
or empty.static boolean
isEmpty
(short[] a) Checks if isnull
or empty.static boolean
Checks if isnull
or empty.static boolean
Checks if isnull
or empty.static boolean
Checks if isnull
or empty.static boolean
isEmpty
(PrimitiveList list) Checks if isnull
or empty.static boolean
isEmpty
(CharSequence cs) Checks if the specifiedCharSequence
isnull
or empty.static boolean
Notnull
or empty.static boolean
Checks if isnull
or empty.static boolean
isEmpty
(Collection<?> c) Checks if isnull
or empty.static boolean
Notnull
or empty.static boolean
Checks if isnull
or empty.static boolean
isEqualCollection
(Collection<?> a, Collection<?> b) Returnstrue
if the givenCollection
s contain exactly the same elements with exactly the same cardinalities.static boolean
Returnstrue
if the specifiedboolean
isBoolean.FALSE
, notnull
orBoolean.TRUE
.static boolean
isNotFalse
(Boolean bool) Returnstrue
if the specifiedboolean
isnull
orBoolean.TRUE
.static boolean
Returnstrue
if the specifiedboolean
isnull
orBoolean.FALSE
.static boolean
isProperSubCollection
(Collection<?> subColl, Collection<?> coll) Returnstrue
if subColl is a proper sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl, and there is at least one element f such that the cardinality of f in coll is strictly greater than the cardinality of f in subColl.static boolean
isSorted
(boolean[] a) static boolean
isSorted
(boolean[] a, int fromIndex, int toIndex) static boolean
isSorted
(byte[] a) static boolean
isSorted
(byte[] a, int fromIndex, int toIndex) static boolean
isSorted
(char[] a) static boolean
isSorted
(char[] a, int fromIndex, int toIndex) static boolean
isSorted
(double[] a) static boolean
isSorted
(double[] a, int fromIndex, int toIndex) static boolean
isSorted
(float[] a) static boolean
isSorted
(float[] a, int fromIndex, int toIndex) static boolean
isSorted
(int[] a) static boolean
isSorted
(int[] a, int fromIndex, int toIndex) static boolean
isSorted
(long[] a) static boolean
isSorted
(long[] a, int fromIndex, int toIndex) static boolean
isSorted
(short[] a) static boolean
isSorted
(short[] a, int fromIndex, int toIndex) static <T extends Comparable<? super T>>
booleanisSorted
(Collection<? extends T> c) static <T extends Comparable<? super T>>
booleanisSorted
(Collection<? extends T> c, int fromIndex, int toIndex) static <T> boolean
isSorted
(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> boolean
isSorted
(Collection<? extends T> c, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
booleanisSorted
(T[] a) static <T extends Comparable<? super T>>
booleanisSorted
(T[] a, int fromIndex, int toIndex) static <T> boolean
isSorted
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> boolean
isSorted
(T[] a, Comparator<? super T> cmp) static boolean
isSubCollection
(Collection<?> subColl, Collection<?> coll) Returnstrue
if subColl is a sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl.static boolean
Returnstrue
if the specifiedboolean
isBoolean.TRUE
, notnull
orBoolean.FALSE
.static <T> Iterator
<T> Returns an iterator over the elements in the specified iterable.static <T> ObjIterator
<T> iterate
(T[] a) Returns an iterator over the elements in the specified array.static <T> ObjIterator
<T> iterate
(T[] a, int fromIndex, int toIndex) Returns an iterator over the elements in the specified array, starting from the 'fromIndex' and ending before the 'toIndex'.static String
Json 2 XML.static String
Json 2 XML.static byte
kthLargest
(byte[] a, int k) Returns the kth largest element in the specified array/collection.static byte
kthLargest
(byte[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static char
kthLargest
(char[] a, int k) Returns the kth largest element in the specified array/collection.static char
kthLargest
(char[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static double
kthLargest
(double[] a, int k) Returns the kth largest element in the specified array/collection.static double
kthLargest
(double[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static float
kthLargest
(float[] a, int k) Returns the kth largest element in the specified array/collection.static float
kthLargest
(float[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static int
kthLargest
(int[] a, int k) Returns the kth largest element in the specified array/collection.static int
kthLargest
(int[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static long
kthLargest
(long[] a, int k) Returns the kth largest element in the specified array/collection.static long
kthLargest
(long[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static short
kthLargest
(short[] a, int k) Returns the kth largest element in the specified array/collection.static short
kthLargest
(short[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static <T extends Comparable<? super T>>
TkthLargest
(Collection<? extends T> c, int k) Returns the kth largest element in the specified array/collection.static <T extends Comparable<? super T>>
TkthLargest
(Collection<? extends T> c, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static <T> T
kthLargest
(Collection<? extends T> c, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) Returns the kth largest element in the specified array/collection within the given range.static <T> T
kthLargest
(Collection<? extends T> c, int k, Comparator<? super T> cmp) Returns the kth largest element in the specified array/collection.static <T extends Comparable<? super T>>
TkthLargest
(T[] a, int k) Returns the kth largest element in the specified array/collection.static <T extends Comparable<? super T>>
TkthLargest
(T[] a, int fromIndex, int toIndex, int k) Returns the kth largest element in the specified array/collection within the given range.static <T> T
kthLargest
(T[] a, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) Returns the kth largest element in the specified array/collection within the given range.static <T> T
kthLargest
(T[] a, int k, Comparator<? super T> cmp) Returns the kth largest element in the specified array/collection.static <T> u.Nullable
<T> lastElement
(Iterable<? extends T> c) Returns the last element in the given Iterable wrapped in a Nullable.static <T> u.Nullable
<T> lastElement
(Iterator<? extends T> iter) Returns the last element in the given Iterator wrapped in a Nullable.static <T> List
<T> lastElements
(Iterable<? extends T> c, int n) Returns a list containing the last 'n' elements from the given Iterable.static <T> List
<T> lastElements
(Iterator<? extends T> iter, int n) Returns a list containing the last n elements from the given Iterator.static <K,
V> u.Optional <Map.Entry<K, V>> static int
lastIndexOf
(boolean[] a, boolean valueToFind) Last index of.static int
lastIndexOf
(boolean[] a, boolean valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(byte[] a, byte valueToFind) Last index of.static int
lastIndexOf
(byte[] a, byte valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(char[] a, char valueToFind) Last index of.static int
lastIndexOf
(char[] a, char valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(double[] a, double valueToFind) Last index of.static int
lastIndexOf
(double[] a, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array.static int
lastIndexOf
(double[] a, double valueToFind, double tolerance, int startIndexFromBack) Finds the last index of the given value in the array starting at the given index.static int
lastIndexOf
(double[] a, double valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(float[] a, float valueToFind) Last index of.static int
lastIndexOf
(float[] a, float valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(int[] a, int valueToFind) Last index of.static int
lastIndexOf
(int[] a, int valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(long[] a, long valueToFind) Last index of.static int
lastIndexOf
(long[] a, long valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(short[] a, short valueToFind) Last index of.static int
lastIndexOf
(short[] a, short valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(Object[] a, Object valueToFind) Last index of.static int
lastIndexOf
(Object[] a, Object valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOf
(Collection<?> c, Object valueToFind) Last index of.static int
lastIndexOf
(Collection<?> c, Object valueToFind, int startIndexFromBack) Last index of.static int
lastIndexOfIgnoreCase
(String[] a, String valueToFind) static int
lastIndexOfIgnoreCase
(String[] a, String valueToFind, int startIndexFromBack) static int
lastIndexOfSubList
(List<?> sourceList, List<?> subListToFind) Last index of sub list.static int
lastIndexOfSubList
(List<?> sourceList, List<?> subListToFind, int startIndexFromBack) Last index of sub list.static <T> u.Optional
<T> lastNonNull
(Iterable<? extends T> c) Returns the last non-null value from the provided iterable.static <T> u.Optional
<T> lastNonNull
(Iterator<? extends T> iter) Returns the last non-null value from the provided iterator.static <T> u.Optional
<T> lastNonNull
(T... a) Returns the last non-null value from the provided array of values.static <T> u.Optional
<T> lastNonNull
(T a, T b) Returns the last non-null value from the provided values.static <T> u.Optional
<T> lastNonNull
(T a, T b, T c) Returns the last non-null value from the provided values.static <T> T
lastOrDefaultIfEmpty
(Iterable<? extends T> c, T defaultValueForEmpty) Last or default if empty.static <T> T
lastOrDefaultIfEmpty
(Iterator<? extends T> iter, T defaultValueForEmpty) Last or default if empty.static <T> T
lastOrDefaultIfEmpty
(T[] a, T defaultValueForEmpty) Last or default if empty.static <T> T
lastOrNullIfEmpty
(Iterable<? extends T> c) Last ornull
if empty.static <T> T
lastOrNullIfEmpty
(Iterator<? extends T> iter) Last ornull
if empty.static <T> T
lastOrNullIfEmpty
(T[] a) Last ornull
if empty.static <T> Supplier
<T> Creates a lazy-initialized supplier from the provided supplier.static <T,
E extends Exception>
Throwables.Supplier<T, E> lazyInitialize
(Throwables.Supplier<T, E> supplier) Creates a lazy-initialized supplier from the provided supplier.static int
len
(boolean[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(byte[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(char[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(double[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(float[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(int[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(long[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(short[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
len
(CharSequence s) Returns the length of the specifiedCharSequence
, or0
if it's empty ornull
.static int
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static <T extends Comparable<? super T>>
booleanlessEqual
(T a, T b) Returnstrue
isa <= b
, otherwisefalse
is returned.static <T> boolean
lessEqual
(T a, T b, Comparator<? super T> cmp) Returnstrue
isa <= b
, otherwisefalse
is returned.static <T extends Comparable<? super T>>
booleanlessThan
(T a, T b) Returnstrue
isa < b
, otherwisefalse
is returned.static <T> boolean
lessThan
(T a, T b, Comparator<? super T> cmp) Returnstrue
isa < b
, otherwisefalse
is returned.static <T,
R> List <R> static <T,
R, C extends Collection<R>>
Cmap
(Iterable<? extends T> c, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) static <T,
R> List <R> map
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
Cmap
(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R, C extends Collection<R>>
Cmap
(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.static <T,
R> List <R> Transforms an array of elements into a list by applying a given function to each element.static <T,
R, C extends Collection<R>>
Cmap
(T[] a, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) static <T> boolean[]
mapToBoolean
(Collection<? extends T> c, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> boolean[]
mapToBoolean
(Collection<? extends T> c, ToBooleanFunction<? super T> mapper) Map to boolean.static <T> boolean[]
mapToBoolean
(T[] a, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> boolean[]
mapToBoolean
(T[] a, ToBooleanFunction<? super T> mapper) Map to boolean.static <T> byte[]
mapToByte
(Collection<? extends T> c, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> byte[]
mapToByte
(Collection<? extends T> c, ToByteFunction<? super T> mapper) Map to byte.static <T> byte[]
mapToByte
(T[] a, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> byte[]
mapToByte
(T[] a, ToByteFunction<? super T> mapper) Map to byte.static <T> char[]
mapToChar
(Collection<? extends T> c, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> char[]
mapToChar
(Collection<? extends T> c, ToCharFunction<? super T> mapper) Map to char.static <T> char[]
mapToChar
(T[] a, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> char[]
mapToChar
(T[] a, ToCharFunction<? super T> mapper) Map to char.static double[]
mapToDouble
(int[] a, IntToDoubleFunction mapper) static double[]
mapToDouble
(long[] a, LongToDoubleFunction mapper) static <T> double[]
mapToDouble
(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> double[]
mapToDouble
(Collection<? extends T> c, ToDoubleFunction<? super T> mapper) Map to double.static <T> double[]
mapToDouble
(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> double[]
mapToDouble
(T[] a, ToDoubleFunction<? super T> mapper) Map to double.static <T> float[]
mapToFloat
(Collection<? extends T> c, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> float[]
mapToFloat
(Collection<? extends T> c, ToFloatFunction<? super T> mapper) Map to float.static <T> float[]
mapToFloat
(T[] a, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> float[]
mapToFloat
(T[] a, ToFloatFunction<? super T> mapper) Map to float.static int[]
mapToInt
(double[] a, DoubleToIntFunction mapper) static int[]
mapToInt
(long[] a, LongToIntFunction mapper) static <T> int[]
mapToInt
(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> int[]
mapToInt
(Collection<? extends T> c, ToIntFunction<? super T> mapper) Map to int.static <T> int[]
mapToInt
(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> int[]
mapToInt
(T[] a, ToIntFunction<? super T> mapper) Map to int.static long[]
mapToLong
(double[] a, DoubleToLongFunction mapper) static long[]
mapToLong
(int[] a, IntToLongFunction mapper) static <T> long[]
mapToLong
(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> long[]
mapToLong
(Collection<? extends T> c, ToLongFunction<? super T> mapper) Map to long.static <T> long[]
mapToLong
(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> long[]
mapToLong
(T[] a, ToLongFunction<? super T> mapper) Map to long.static <T> short[]
mapToShort
(Collection<? extends T> c, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> short[]
mapToShort
(Collection<? extends T> c, ToShortFunction<? super T> mapper) Map to short.static <T> short[]
mapToShort
(T[] a, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) Mostly it's designed for one-step operation to complete the operation in one step.static <T> short[]
mapToShort
(T[] a, ToShortFunction<? super T> mapper) Map to short.static byte
max
(byte... a) Returns the maximum value among the provided values.static byte
max
(byte[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static byte
max
(byte a, byte b) Returns the maximum value among the provided values.static byte
max
(byte a, byte b, byte c) Returns the maximum value among the provided values.static char
max
(char... a) Returns the maximum value among the provided values.static char
max
(char[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static char
max
(char a, char b) Returns the maximum value among the provided values.static char
max
(char a, char b, char c) Returns the maximum value among the provided values.static double
max
(double... a) Returns the maximum value among the provided values.static double
max
(double[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static double
max
(double a, double b) Returns the maximum value among the provided values.static double
max
(double a, double b, double c) Returns the maximum value among the provided values.static float
max
(float... a) Returns the maximum value among the provided values.static float
max
(float[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static float
max
(float a, float b) Returns the maximum value among the provided values.static float
max
(float a, float b, float c) Returns the maximum value among the provided values.static int
max
(int... a) Returns the maximum value among the provided values.static int
max
(int[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static int
max
(int a, int b) Returns the maximum value among the provided values.static int
max
(int a, int b, int c) Returns the maximum value among the provided values.static long
max
(long... a) Returns the maximum value among the provided values.static long
max
(long[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static long
max
(long a, long b) Returns the maximum value among the provided values.static long
max
(long a, long b, long c) Returns the maximum value among the provided values.static short
max
(short... a) Returns the maximum value among the provided values.static short
max
(short[] a, int fromIndex, int toIndex) Returns the maximum value among the given range in the specified Array/Collection.static short
max
(short a, short b) Returns the maximum value among the provided values.static short
max
(short a, short b, short c) Returns the maximum value among the provided values.static <T extends Comparable<? super T>>
TReturns the maximum value among the provided values based on their natural ordering.static <T> T
max
(Iterable<? extends T> c, Comparator<? super T> cmp) Returns the maximum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmax
(Collection<? extends T> c, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering.static <T> T
max
(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the maximum value among the given range in the specified Array/Collection according to the provided comparator.static <T extends Comparable<? super T>>
TReturns the maximum value among the provided values based on their natural ordering.static <T> T
max
(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns the maximum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmax
(T[] a) Returns the maximum value among the provided values based on their natural ordering.static <T extends Comparable<? super T>>
Tmax
(T[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering.static <T> T
max
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the maximum value among the given range in the specified Array/Collection according to the provided comparator.static <T> T
max
(T[] a, Comparator<? super T> cmp) Returns the maximum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmax
(T a, T b) Returns the maximum value among the provided values based on their natural ordering.static <T> T
max
(T a, T b, Comparator<? super T> cmp) Returns the maximum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmax
(T a, T b, T c) Returns the maximum value among the provided values based on their natural ordering.static <T> T
max
(T a, T b, T c, Comparator<? super T> cmp) Returns the maximum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list of all the maximum values in the provided values, based on their natural ordering.static <T> List
<T> maxAll
(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a list of all the maximum values in the provided values, based on the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list of all the maximum values in the provided values, based on their natural ordering.static <T> List
<T> maxAll
(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a list of all the maximum values in the provided values, based on the provided comparator.static <T extends Comparable<? super T>>
List<T> maxAll
(T[] a) Returns a list of all the maximum values in the provided values, based on their natural ordering.static <T> List
<T> maxAll
(T[] a, Comparator<? super T> cmp) Returns a list of all the maximum values in the provided values, based on the provided comparator.static <T> double
maxDoubleOrDefaultIfEmpty
(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> double
maxDoubleOrDefaultIfEmpty
(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> double
maxDoubleOrDefaultIfEmpty
(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
maxIntOrDefaultIfEmpty
(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
maxIntOrDefaultIfEmpty
(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
maxIntOrDefaultIfEmpty
(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
maxLongOrDefaultIfEmpty
(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
maxLongOrDefaultIfEmpty
(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
maxLongOrDefaultIfEmpty
(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T,
R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty
(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified collection c byvalueExtractor
, ordefaultValue
if c isnull
or empty.static <T,
R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty
(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if iter isnull
or empty.static <T,
R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty
(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static byte
median
(byte... a) Returns thelength / 2 + 1
largest value in the specified array.static byte
median
(byte[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic byte
median
(byte a, byte b, byte c) Returns the median of provided values.static char
median
(char... a) Returns thelength / 2 + 1
largest value in the specified array.static char
median
(char[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic char
median
(char a, char b, char c) Returns the median of provided values.static double
median
(double... a) Returns thelength / 2 + 1
largest value in the specified array.static double
median
(double[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic double
median
(double a, double b, double c) Returns the median of provided values.static float
median
(float... a) Returns thelength / 2 + 1
largest value in the specified array.static float
median
(float[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic float
median
(float a, float b, float c) Returns the median of provided values.static int
median
(int... a) Returns thelength / 2 + 1
largest value in the specified array.static int
median
(int[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic int
median
(int a, int b, int c) Returns the median of provided values.static long
median
(long... a) Returns thelength / 2 + 1
largest value in the specified array.static long
median
(long[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic long
median
(long a, long b, long c) Returns the median of provided values.static short
median
(short... a) Returns thelength / 2 + 1
largest value in the specified array.static short
median
(short[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic short
median
(short a, short b, short c) Returns the median of provided values.static <T extends Comparable<? super T>>
Tmedian
(Collection<? extends T> c) Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.static <T extends Comparable<? super T>>
Tmedian
(Collection<? extends T> c, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic <T> T
median
(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the median of the specified values within the given range based on the provided comparator.static <T> T
median
(Collection<? extends T> c, Comparator<? super T> cmp) Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.static <T extends Comparable<? super T>>
Tmedian
(T[] a) Returns thelength / 2 + 1
largest value in the specified array.static <T extends Comparable<? super T>>
Tmedian
(T[] a, int fromIndex, int toIndex) Returns the median of the specified values within the given rangestatic <T> T
median
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the median of the specified values within the given range based on the provided comparator.static <T> T
median
(T[] a, Comparator<? super T> cmp) Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.static <T extends Comparable<? super T>>
Tmedian
(T a, T b, T c) Returns the median of provided values.static <T> T
median
(T a, T b, T c, Comparator<? super T> cmp) Returns the median of the provided values based on the provided comparator.static DataSet
Merges two given DataSets into a single DataSet.static DataSet
Merges three given DataSets into a single DataSet.static <T> List
<T> merge
(Iterable<? extends T> a, Iterable<? extends T> b, BiFunction<? super T, ? super T, MergeResult> nextSelector) static <T> T
Merges the properties from the source object into the target object.static <T> T
merge
(Object sourceBean, T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames) Merges the properties from the source object into the target object, except the properties specified in theignoredPropNames
set.static <T> T
merge
(Object sourceBean, T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function, except the properties specified in theignoredPropNames
set.static <T> T
merge
(Object sourceBean, T targetBean, Collection<String> selectPropNames) Merges the selected properties from the source object into the target object.static <T> T
merge
(Object sourceBean, T targetBean, Collection<String> selectPropNames, BinaryOperator<?> mergeFunc) Merges the selected properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter) Merges the selected properties from the source object into the target object.static <T> T
merge
(Object sourceBean, T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the selected properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter) Merges the filtered properties from the source object into the target object, The source object's properties will overwrite the same properties in the target object.static <T> T
merge
(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> T
merge
(Object sourceBean, T targetBean, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function.static DataSet
merge
(Collection<? extends DataSet> dss) Merges a collection of DataSets into a single DataSet.static DataSet
merge
(Collection<? extends DataSet> dss, boolean requiresSameColumns) Merges a collection of DataSets into a single DataSet.static <T> List
<T> merge
(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector) static <T,
C extends Collection<T>>
Cmerge
(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector, IntFunction<? extends C> supplier) static <T> List
<T> merge
(T[] a, T[] b, BiFunction<? super T, ? super T, MergeResult> nextSelector) static byte
min
(byte... a) Returns the minimum value among the provided values.static byte
min
(byte[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static byte
min
(byte a, byte b) Returns the minimum value among the provided values.static byte
min
(byte a, byte b, byte c) Returns the minimum value among the provided values.static char
min
(char... a) Returns the minimum value among the provided values.static char
min
(char[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static char
min
(char a, char b) Returns the minimum value among the provided values.static char
min
(char a, char b, char c) Returns the minimum value among the provided values.static double
min
(double... a) Returns the minimum value among the provided values.static double
min
(double[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static double
min
(double a, double b) Returns the minimum value among the provided values.static double
min
(double a, double b, double c) Returns the minimum value among the provided values.static float
min
(float... a) Returns the minimum value among the provided values.static float
min
(float[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static float
min
(float a, float b) Returns the minimum value among the provided values.static float
min
(float a, float b, float c) Returns the minimum value among the provided values.static int
min
(int... a) Returns the minimum value among the provided values.static int
min
(int[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static int
min
(int a, int b) Returns the minimum value among the provided values.static int
min
(int a, int b, int c) Returns the minimum value among the provided values.static long
min
(long... a) Returns the minimum value among the provided values.static long
min
(long[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static long
min
(long a, long b) Returns the minimum value among the provided values.static long
min
(long a, long b, long c) Returns the minimum value among the provided values.static short
min
(short... a) Returns the minimum value among the provided values.static short
min
(short[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection.static short
min
(short a, short b) Returns the minimum value among the provided values.static short
min
(short a, short b, short c) Returns the minimum value among the provided values.static <T extends Comparable<? super T>>
TReturns the minimum value among the provided values based on their natural ordering.static <T> T
min
(Iterable<? extends T> c, Comparator<? super T> cmp) Returns the minimum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmin
(Collection<? extends T> c, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering.static <T> T
min
(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the minimum value among the given range in the specified Array/Collection according to the provided comparator.static <T extends Comparable<? super T>>
TReturns the minimum value among the provided values based on their natural ordering.static <T> T
min
(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns the minimum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmin
(T[] a) Returns the minimum value among the provided values based on their natural ordering.static <T extends Comparable<? super T>>
Tmin
(T[] a, int fromIndex, int toIndex) Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering.static <T> T
min
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the minimum value among the given range in the specified Array/Collection according to the provided comparator.static <T> T
min
(T[] a, Comparator<? super T> cmp) Returns the minimum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmin
(T a, T b) Returns the minimum value among the provided values based on their natural ordering.static <T> T
min
(T a, T b, Comparator<? super T> cmp) Returns the minimum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmin
(T a, T b, T c) Returns the minimum value among the three provided values based on their natural ordering.static <T> T
min
(T a, T b, T c, Comparator<? super T> cmp) Returns the minimum value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list of all the minimum values in the provided values, based on their natural ordering.static <T> List
<T> minAll
(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a list of all the minimum values in the provided array, based on the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list of all the minimum values in the provided values, based on their natural ordering.static <T> List
<T> minAll
(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a list of all the minimum values in the provided array, based on the provided comparator.static <T extends Comparable<? super T>>
List<T> minAll
(T[] a) Returns a list of all the minimum values in the provided values, based on their natural ordering.static <T> List
<T> minAll
(T[] a, Comparator<? super T> cmp) Returns a list of all the minimum values in the provided array, based on the provided comparator.static <T> double
minDoubleOrDefaultIfEmpty
(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> double
minDoubleOrDefaultIfEmpty
(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> double
minDoubleOrDefaultIfEmpty
(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
minIntOrDefaultIfEmpty
(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
minIntOrDefaultIfEmpty
(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> int
minIntOrDefaultIfEmpty
(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
minLongOrDefaultIfEmpty
(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
minLongOrDefaultIfEmpty
(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T> long
minLongOrDefaultIfEmpty
(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static <T extends Comparable<? super T>>
Pair<T, T> Returns a pair of the minimum and maximum values in the specified Iterable.static <T> Pair
<T, T> minMax
(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a pair of the minimum and maximum values in the specified Iterable, based on the provided comparator.static <T extends Comparable<? super T>>
Pair<T, T> Returns a pair of the minimum and maximum values in the specified Iterator.static <T> Pair
<T, T> minMax
(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a pair of the minimum and maximum values in the specified Iterator, based on the provided comparator.static <T extends Comparable<? super T>>
Pair<T, T> minMax
(T[] a) Returns a pair of the minimum and maximum values in the specified array.static <T> Pair
<T, T> minMax
(T[] a, Comparator<? super T> cmp) Returns a pair of the minimum and maximum values in the specified array, based on the provided comparator.static <T,
R extends Comparable<? super R>>
RminOrDefaultIfEmpty
(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified collection c byvalueExtractor
, ordefaultValue
if c isnull
or empty.static <T,
R extends Comparable<? super R>>
RminOrDefaultIfEmpty
(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if iter isnull
or empty.static <T,
R extends Comparable<? super R>>
RminOrDefaultIfEmpty
(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.static int
mismatch
(boolean[] a, boolean[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two boolean arrays starting from specified indices.static int
mismatch
(byte[] a, byte[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two byte arrays starting from specified indices.static int
mismatch
(char[] a, char[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two char arrays starting from specified indices.static int
mismatch
(double[] a, double[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two double arrays starting from specified indices.static int
mismatch
(float[] a, float[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two float arrays starting from specified indices.static int
mismatch
(int[] a, int[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two int arrays starting from specified indices.static int
mismatch
(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two long arrays starting from specified indices.static int
mismatch
(long[] a, long[] b) Finds and returns the index of the first mismatch between two arrays.static int
mismatch
(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two short arrays starting from specified indices.static int
mismatch
(short[] a, short[] b) Finds and returns the index of the first mismatch between two arrays.static <T extends Comparable<? super T>>
intFinds and returns the index of the first mismatch between two iterables.static <T> int
mismatch
(Iterable<T> a, Iterable<T> b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two iterables using the specified comparator.static <T> int
mismatch
(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two collections starting from specified indices.static <T> int
mismatch
(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two collections starting from specified indices.static <T extends Comparable<? super T>>
intFinds and returns the index of the first mismatch between two iterators.static <T> int
mismatch
(Iterator<T> a, Iterator<T> b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two iterators using the specified comparator.static <T extends Comparable<? super T>>
intmismatch
(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two arrays starting from specified indices.static <T> int
mismatch
(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two arrays starting from specified indices.static <T extends Comparable<? super T>>
intmismatch
(T[] a, T[] b) Finds and returns the index of the first mismatch between two arrays.static <T> int
mismatch
(T[] a, T[] b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two arrays.static void
moveRange
(boolean[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(byte[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(char[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(double[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(float[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(int[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(long[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
moveRange
(short[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static String
Returns a new string with the specified range moved to the new position.static <T> boolean
Moves a range of elements in the given list to a new position within the list.static <T> void
moveRange
(T[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static void
negate
(boolean[] a) Negates boolean values in the specified boolean arraystatic void
negate
(boolean[] a, int fromIndex, int toIndex) Negates boolean valuesfromIndex
totoIndex
in the specified boolean arraystatic Boolean
Note: copied from Apache commons Lang under Apache license v2.0static <T> T
static <T> T
static <T> ArrayDeque
<T> New array deque.static <T> ArrayDeque
<T> newArrayDeque
(int numElements) Constructs an empty array deque with an initial capacity sufficient to hold the specified number of elements.static <E> ArrayDeque
<E> newArrayDeque
(Collection<? extends E> c) Constructs a deque containing the elements of the specified collection, in the order they are returned by the collection's iterator.static <T> ArrayList
<T> New array list.static <T> ArrayList
<T> newArrayList
(int initialCapacity) New array list.static <T> ArrayList
<T> newArrayList
(Collection<? extends T> c) New array list.static <T> T
static <T> T
static <K,
V> BiMap <K, V> newBiMap()
New bi map.static <K,
V> BiMap <K, V> newBiMap
(int initialCapacity) New bi map.static <K,
V> BiMap <K, V> newBiMap
(int initialCapacity, float loadFactor) New bi map.static <K,
V> BiMap <K, V> New bi map.static <K,
V> BiMap <K, V> newBiMap
(Supplier<? extends Map<K, V>> keyMapSupplier, Supplier<? extends Map<V, K>> valueMapSupplier) New bi map.static <T> Collection
<T> newCollection
(Class<? extends Collection> targetType) static <T> Collection
<T> newCollection
(Class<? extends Collection> targetType, int size) static <K,
V> ConcurrentHashMap <K, V> New concurrent hash map.static <K,
V> ConcurrentHashMap <K, V> newConcurrentHashMap
(int initialCapacity) New concurrent hash map.static <K,
V> ConcurrentHashMap <K, V> newConcurrentHashMap
(Map<? extends K, ? extends V> m) New concurrent hash map.static <T> Set
<T> New hash set.static <T> Set
<T> newConcurrentHashSet
(int initialCapacity) New hash set.static <T> Set
<T> newConcurrentHashSet
(Collection<? extends T> c) New hash set.static DataSet
newDataSet
(String keyColumnName, String valueColumnName, Map<?, ?> m) Creates a new DataSet from the provided Map.static DataSet
newDataSet
(String columnName, Collection<?> column) Creates a new DataSet with single column from the provided Collection.static DataSet
newDataSet
(Collection<?> rows) Creates a new DataSet with the specified rows.static DataSet
newDataSet
(Collection<?> rows, Map<String, Object> properties) Creates a new DataSet with the specified rows and properties.static DataSet
newDataSet
(Collection<String> columnNames, Object[][] rowList) Creates a new DataSet with the specified column names and rows.static DataSet
newDataSet
(Collection<String> columnNames, Collection<?> rows) Creates a new DataSet with the specified column names and rows.static DataSet
newDataSet
(Collection<String> columnNames, Collection<?> rows, Map<String, Object> properties) Creates a new DataSet with the specified column names, rows, and properties.static <C extends Collection<?>>
DataSetnewDataSet
(Map<String, C> map) Creates a new DataSet from the provided Map.static DataSet
Creates a new empty DataSet.static DataSet
newEmptyDataSet
(Collection<String> columnNames) Creates a new empty DataSet with the specified column names.static DataSet
newEmptyDataSet
(Collection<String> columnNames, Map<String, Object> properties) Creates a new empty DataSet with the specified column names and properties.static <K,
V> Map.Entry <K, V> newEntry
(K key, V value) static <K,
V> Map <K, V> New hash map.static <K,
V> Map <K, V> newHashMap
(int initialCapacity) New hash map.static <K,
V> Map <K, V> newHashMap
(Collection<? extends V> c, Function<? super V, ? extends K> keyMapper) New hash map.static <K,
V> Map <K, V> newHashMap
(Map<? extends K, ? extends V> m) New hash map.static <T> Set
<T> New hash set.static <T> Set
<T> newHashSet
(int initialCapacity) New hash set.static <T> Set
<T> newHashSet
(Collection<? extends T> c) New hash set.static <K,
V> IdentityHashMap <K, V> New identity hash map.static <K,
V> IdentityHashMap <K, V> newIdentityHashMap
(int initialCapacity) New identity hash map.static <K,
V> IdentityHashMap <K, V> newIdentityHashMap
(Map<? extends K, ? extends V> m) New identity hash map.static <K,
V> ImmutableEntry <K, V> newImmutableEntry
(K key, V value) New immutable/unmodifiable entry.static <T> T
newInstance
(Class<T> cls) static <K,
V> Map <K, V> New linked hash map.static <K,
V> Map <K, V> newLinkedHashMap
(int initialCapacity) New linked hash map.static <K,
V> Map <K, V> newLinkedHashMap
(Collection<? extends V> c, Function<? super V, ? extends K> keyMapper) New linked hash map.static <K,
V> Map <K, V> newLinkedHashMap
(Map<? extends K, ? extends V> m) New linked hash map.static <T> Set
<T> New linked hash set.static <T> Set
<T> newLinkedHashSet
(int initialCapacity) New linked hash set.static <T> Set
<T> newLinkedHashSet
(Collection<? extends T> c) New linked hash set.static <T> LinkedList
<T> New linked list.static <T> LinkedList
<T> newLinkedList
(Collection<? extends T> c) New linked list.static <K,
E> ListMultimap <K, E> Returns aListMultimap
backed byLinkedHashMap
.static <K,
E> ListMultimap <K, E> newLinkedListMultimap
(int initialCapacity) Returns aListMultimap
backed byLinkedHashMap
.static <K,
E> ListMultimap <K, E> newLinkedListMultimap
(Map<? extends K, ? extends E> m) Returns aListMultimap
backed byLinkedHashMap
.static <K,
E> SetMultimap <K, E> Returns aSetMultimap
backed byLinkedHashMap
.static <K,
E> SetMultimap <K, E> newLinkedSetMultimap
(int initialCapacity) Returns aSetMultimap
backed byLinkedHashMap
.static <K,
E> SetMultimap <K, E> newLinkedSetMultimap
(Map<? extends K, ? extends E> m) Returns aSetMultimap
backed byLinkedHashMap
.static <K,
E> ListMultimap <K, E> New list multimap.static <K,
E> ListMultimap <K, E> newListMultimap
(int initialCapacity) New list multimap.static <K,
E> ListMultimap <K, E> newListMultimap
(Class<? extends Map> mapType) New list multimap.static <K,
E> ListMultimap <K, E> newListMultimap
(Class<? extends Map> mapType, Class<? extends List> valueType) New list multimap.static <T,
K> ListMultimap <K, T> newListMultimap
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) static <T,
K, E> ListMultimap <K, E> newListMultimap
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends E> valueExtractor) static <K,
E> ListMultimap <K, E> newListMultimap
(Supplier<? extends Map<K, List<E>>> mapSupplier, Supplier<? extends List<E>> valueSupplier) New list multimap.static <K,
E> ListMultimap <K, E> newListMultimap
(Map<? extends K, ? extends E> m) New list multimap.static <K,
V> Map <K, V> static <K,
V> Map <K, V> static <K,
E, V extends Collection<E>>
Multimap<K, E, V> newMultimap
(Supplier<? extends Map<K, V>> mapSupplier, Supplier<? extends V> valueSupplier) static <T> Multiset
<T> static <T> Multiset
<T> newMultiset
(int initialCapacity) static <T> Multiset
<T> newMultiset
(Class<? extends Map> valueMapType) static <T> Multiset
<T> newMultiset
(Collection<? extends T> c) static <T> Multiset
<T> newMultiset
(Supplier<? extends Map<T, ?>> mapSupplier) static <T> T
newProxyInstance
(Class<?>[] interfaceClasses, InvocationHandler h) Creates a new proxy instance for the specified interfaces using the provided invocation handler.static <T> T
newProxyInstance
(Class<T> interfaceClass, InvocationHandler h) Creates a new proxy instance for the specified interface using the provided invocation handler.static <E> Set
<E> newSetFromMap
(Map<E, Boolean> map) Returns a set backed by the specified map.static <K,
E> SetMultimap <K, E> New set multimap.static <K,
E> SetMultimap <K, E> newSetMultimap
(int initialCapacity) New set multimap.static <K,
E> SetMultimap <K, E> newSetMultimap
(Class<? extends Map> mapType) New set multimap.static <K,
E> SetMultimap <K, E> newSetMultimap
(Class<? extends Map> mapType, Class<? extends Set> valueType) New set multimap.static <T,
K> SetMultimap <K, T> newSetMultimap
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) static <T,
K, E> SetMultimap <K, E> newSetMultimap
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends E> valueExtractor) static <K,
E> SetMultimap <K, E> newSetMultimap
(Supplier<? extends Map<K, Set<E>>> mapSupplier, Supplier<? extends Set<E>> valueSupplier) New set multimap.static <K,
E> SetMultimap <K, E> newSetMultimap
(Map<? extends K, ? extends E> m) New set multimap.static <K extends Comparable<? super K>,
E>
ListMultimap<K, E> Returns aListMultimap
backed bySortedMap
.static <K extends Comparable<? super K>,
E>
ListMultimap<K, E> newSortedListMultimap
(Map<? extends K, ? extends E> m) Returns aListMultimap
backed bySortedMap
.static <K extends Comparable<? super K>,
E>
SetMultimap<K, E> Returns aSetMultimap
backed bySortedMap
.static <K extends Comparable<? super K>,
E>
SetMultimap<K, E> newSortedSetMultimap
(Map<? extends K, ? extends E> m) Returns aSetMultimap
backed bySortedMap
.static <K extends Comparable<? super K>,
V>
TreeMap<K, V> New tree map.static <C,
K extends C, V>
TreeMap<K, V> newTreeMap
(Comparator<C> comparator) New tree map.static <K extends Comparable<? super K>,
V>
TreeMap<K, V> newTreeMap
(Map<? extends K, ? extends V> m) New tree map.static <K,
V> TreeMap <K, V> newTreeMap
(SortedMap<K, ? extends V> m) New tree map.static <T extends Comparable<? super T>>
TreeSet<T> New tree set.static <T extends Comparable<? super T>>
TreeSet<T> newTreeSet
(Collection<? extends T> c) New tree set.static <T> TreeSet
<T> newTreeSet
(Comparator<? super T> comparator) New tree set.static <T> TreeSet
<T> newTreeSet
(SortedSet<T> c) New tree set.static <T> boolean
Checks if a certain number of elements in theiterable
match the provided predicate.static <T> boolean
Checks if a certain number of elements in the iterator match the provided predicate.static <T> boolean
Checks if a certain number of elements in the array match the provided predicate.static <T> boolean
static <T> boolean
static <T> boolean
static boolean
notBlank
(CharSequence cs) static boolean
notEmpty
(boolean[] a) Notnull
or empty.static boolean
notEmpty
(byte[] a) Notnull
or empty.static boolean
notEmpty
(char[] a) Notnull
or empty.static boolean
notEmpty
(double[] a) Notnull
or empty.static boolean
notEmpty
(float[] a) Notnull
or empty.static boolean
notEmpty
(int[] a) Notnull
or empty.static boolean
notEmpty
(long[] a) Notnull
or empty.static boolean
notEmpty
(short[] a) Notnull
or empty.static boolean
Notnull
or empty.static boolean
Notnull
or empty.static boolean
Notnull
or empty.static boolean
notEmpty
(PrimitiveList list) Notnull
or empty.static boolean
notEmpty
(CharSequence cs) static boolean
Notnull
or empty.static boolean
Notnull
or empty.static boolean
notEmpty
(Collection<?> c) Notnull
or empty.static boolean
Notnull
or empty.static boolean
Notnull
or empty.static boolean[]
nullToEmpty
(boolean[] a) Null to empty.static byte[]
nullToEmpty
(byte[] a) Null to empty.static char[]
nullToEmpty
(char[] a) Null to empty.static double[]
nullToEmpty
(double[] a) Null to empty.static float[]
nullToEmpty
(float[] a) Null to empty.static int[]
nullToEmpty
(int[] a) Null to empty.static long[]
nullToEmpty
(long[] a) Null to empty.static short[]
nullToEmpty
(short[] a) Null to empty.static <K,
V> ImmutableBiMap <K, V> nullToEmpty
(ImmutableBiMap<K, V> map) Returns an empty immutable/unmodifiable map if the specified ImmutableBiMap isnull
, otherwise itself is returned.static <T> ImmutableCollection
<T> Returns an empty immutable/unmodifiable Collection if the specified ImmutableCollection isnull
, otherwise itself is returned.static <T> ImmutableList
<T> nullToEmpty
(ImmutableList<T> list) Returns an empty immutable/unmodifiable list if the specified ImmutableList isnull
, otherwise itself is returned.static <K,
V> ImmutableMap <K, V> nullToEmpty
(ImmutableMap<K, V> map) Returns an empty immutable/unmodifiable map if the specified ImmutableMap isnull
, otherwise itself is returned.static <K,
V> ImmutableNavigableMap <K, V> nullToEmpty
(ImmutableNavigableMap<K, V> map) Returns an empty immutable/unmodifiable map if the specified ImmutableNavigableMap isnull
, otherwise itself is returned.static <T> ImmutableNavigableSet
<T> nullToEmpty
(ImmutableNavigableSet<T> set) Returns an empty immutable/unmodifiable list if the specified ImmutableNavigableSet isnull
, otherwise itself is returned.static <T> ImmutableSet
<T> nullToEmpty
(ImmutableSet<T> set) Returns an empty immutable/unmodifiable list if the specified ImmutableSet isnull
, otherwise itself is returned.static <K,
V> ImmutableSortedMap <K, V> nullToEmpty
(ImmutableSortedMap<K, V> map) Returns an empty immutable/unmodifiable map if the specified ImmutableSortedMap isnull
, otherwise itself is returned.static <T> ImmutableSortedSet
<T> nullToEmpty
(ImmutableSortedSet<T> set) Returns an empty immutable/unmodifiable list if the specified ImmutableSortedSet isnull
, otherwise itself is returned.static Object[]
nullToEmpty
(Object[] a) Null to empty.static String
nullToEmpty
(String str) static String[]
nullToEmpty
(String[] a) Null to empty.static BigDecimal[]
nullToEmpty
(BigDecimal[] a) Null to empty.static BigInteger[]
nullToEmpty
(BigInteger[] a) Null to empty.static Date[]
nullToEmpty
(Date[] a) Null to empty.static Time[]
nullToEmpty
(Time[] a) Null to empty.static Timestamp[]
nullToEmpty
(Timestamp[] a) Null to empty.static Calendar[]
nullToEmpty
(Calendar[] a) Null to empty.static <T> Collection
<T> nullToEmpty
(Collection<T> c) Returns an empty immutable/unmodifiable list if the specified Collection isnull
, otherwise itself is returned.static Date[]
nullToEmpty
(Date[] a) Null to empty.static <T> Iterator
<T> nullToEmpty
(Iterator<T> iter) Returns an empty immutable/unmodifiableIterator
if the specified Iterator isnull
, otherwise itself is returned.static <T> List
<T> nullToEmpty
(List<T> list) Returns an empty immutable/unmodifiable list if the specified List isnull
, otherwise itself is returned.static <T> ListIterator
<T> nullToEmpty
(ListIterator<T> iter) Returns an empty immutable/unmodifiableListIterator
if the specified ListIterator isnull
, otherwise itself is returned.static <K,
V> Map <K, V> nullToEmpty
(Map<K, V> map) Returns an empty immutable/unmodifiable map if the specified Map isnull
, otherwise itself is returned.static <K,
V> NavigableMap <K, V> nullToEmpty
(NavigableMap<K, V> map) Returns an empty immutable/unmodifiableNavigableMap
if the specified NavigableMap isnull
, otherwise itself is returned.static <T> NavigableSet
<T> nullToEmpty
(NavigableSet<T> set) Returns an empty immutable/unmodifiableNavigableSet
if the specified NavigableSet isnull
, otherwise itself is returned.static <T> Set
<T> nullToEmpty
(Set<T> set) Returns an empty immutable/unmodifiable set if the specified Set isnull
, otherwise itself is returned.static <K,
V> SortedMap <K, V> nullToEmpty
(SortedMap<K, V> map) Returns an empty immutable/unmodifiableSortedMap
if the specified SortedMap isnull
, otherwise itself is returned.static <T> SortedSet
<T> nullToEmpty
(SortedSet<T> set) Returns an empty immutable/unmodifiableSortedSet
if the specified SortedSet isnull
, otherwise itself is returned.static <T> T[]
nullToEmpty
(T[] a, Class<T[]> arrayType) Null to empty.static String[]
nullToEmptyForEach
(String[] a) Converts the specified String array to an emptyString[0]
if it'snull
and eachnull
element String to empty String""
.occurrencesMap
(Iterable<? extends T> c) Returns a map with the occurrences of each element in the given iterable collection.occurrencesMap
(Iterable<? extends T> c, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterable collection.occurrencesMap
(Iterator<? extends T> iter) Returns a map with the occurrences of each element in the given iterator.occurrencesMap
(Iterator<? extends T> iter, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterator.occurrencesMap
(T[] a) Returns a map with the occurrences of each element in the given array.occurrencesMap
(T[] a, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given array.static int
occurrencesOf
(boolean[] a, boolean valueToFind) Counts the occurrences of a specific boolean value in a boolean array.static int
occurrencesOf
(byte[] a, byte valueToFind) Counts the occurrences of a specific byte value in a byte array.static int
occurrencesOf
(char[] a, char valueToFind) Counts the occurrences of a specific char value in a char array.static int
occurrencesOf
(double[] a, double valueToFind) Counts the occurrences of a specific double value in a double array.static int
occurrencesOf
(float[] a, float valueToFind) Counts the occurrences of a specific float value in a float array.static int
occurrencesOf
(int[] a, int valueToFind) Counts the occurrences of a specific int value in a int array.static int
occurrencesOf
(long[] a, long valueToFind) Counts the occurrences of a specific long value in a long array.static int
occurrencesOf
(short[] a, short valueToFind) Counts the occurrences of a specific short value in a short array.static int
occurrencesOf
(Iterable<?> c, Object valueToFind) Counts the occurrences of a specific Object value in anIterable
.static int
occurrencesOf
(Object[] a, Object valueToFind) Counts the occurrences of a specific Object value in an Object array.static int
occurrencesOf
(String str, char valueToFind) Counts the occurrences of a specific character in a String.static int
occurrencesOf
(String str, String valueToFind) Counts the occurrences of a specific String value in another String.static int
occurrencesOf
(Iterator<?> iter, Object valueToFind) Counts the occurrences of a specific Object value in anIterator
.static <T> boolean
Appends the provided object to the beginning of the list till the list has at least the specified minimum size.static <T> boolean
padRight
(Collection<T> c, int minSize, T objToAdd) Appends the provided object to the end of the list till the list has at least the specified minimum size.static void
parallelSort
(byte[] a) static void
parallelSort
(byte[] a, int fromIndex, int toIndex) static void
parallelSort
(char[] a) static void
parallelSort
(char[] a, int fromIndex, int toIndex) static void
parallelSort
(double[] a) static void
parallelSort
(double[] a, int fromIndex, int toIndex) static void
parallelSort
(float[] a) static void
parallelSort
(float[] a, int fromIndex, int toIndex) static void
parallelSort
(int[] a) static void
parallelSort
(int[] a, int fromIndex, int toIndex) static void
parallelSort
(long[] a) static void
parallelSort
(long[] a, int fromIndex, int toIndex) static void
parallelSort
(short[] a) static void
parallelSort
(short[] a, int fromIndex, int toIndex) static <T extends Comparable<? super T>>
voidparallelSort
(List<? extends T> list) static <T extends Comparable<? super T>>
voidparallelSort
(List<? extends T> list, int fromIndex, int toIndex) static <T> void
parallelSort
(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> void
parallelSort
(List<? extends T> list, Comparator<? super T> cmp) static <T extends Comparable<? super T>>
voidparallelSort
(T[] a) static <T extends Comparable<? super T>>
voidparallelSort
(T[] a, int fromIndex, int toIndex) static <T> void
parallelSort
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> void
parallelSort
(T[] a, Comparator<? super T> cmp) static <T,
U extends Comparable<? super U>>
voidparallelSortBy
(List<? extends T> list, Function<? super T, ? extends U> keyMapper) Parallel sort by.static <T,
U extends Comparable<? super U>>
voidparallelSortBy
(T[] a, Function<? super T, ? extends U> keyMapper) Parallel sort by.static <T> void
parallelSortByDouble
(List<? extends T> list, ToDoubleFunction<? super T> keyMapper) Parallel sort by double.static <T> void
parallelSortByDouble
(T[] a, ToDoubleFunction<? super T> keyMapper) Parallel sort by double.static <T> void
parallelSortByFloat
(List<? extends T> list, ToFloatFunction<? super T> keyMapper) Parallel sort by float.static <T> void
parallelSortByFloat
(T[] a, ToFloatFunction<? super T> keyMapper) Parallel sort by float.static <T> void
parallelSortByInt
(List<? extends T> list, ToIntFunction<? super T> keyMapper) Parallel sort by int.static <T> void
parallelSortByInt
(T[] a, ToIntFunction<? super T> keyMapper) Parallel sort by int.static <T> void
parallelSortByLong
(List<? extends T> list, ToLongFunction<? super T> keyMapper) Parallel sort by long.static <T> void
parallelSortByLong
(T[] a, ToLongFunction<? super T> keyMapper) Parallel sort by long.static Map
<Percentage, Byte> percentiles
(byte[] sortedArray) Calculates the percentiles of the provided sorted array of bytes.static Map
<Percentage, Character> percentiles
(char[] sortedArray) Calculates the percentiles of the provided sorted array of characters.static Map
<Percentage, Double> percentiles
(double[] sortedArray) Calculates the percentiles of the provided sorted array of doubles.static Map
<Percentage, Float> percentiles
(float[] sortedArray) Calculates the percentiles of the provided sorted array of floats.static Map
<Percentage, Integer> percentiles
(int[] sortedArray) Calculates the percentiles of the provided sorted array of integers.static Map
<Percentage, Long> percentiles
(long[] sortedArray) Calculates the percentiles of the provided sorted array of longs.static Map
<Percentage, Short> percentiles
(short[] sortedArray) Calculates the percentiles of the provided sorted array of shorts.static <T> Map
<Percentage, T> percentiles
(List<T> sortedList) Calculates the percentiles of the provided sorted list.static <T> Map
<Percentage, T> percentiles
(T[] sortedArray) Calculates the percentiles of the provided sorted array.static <T> T
println
(T obj) Prints the given object to the standard output stream (System.out) and returns the object.static boolean
registerConverter
(Class<?> srcClass, BiFunction<?, Class<?>, ?> converter) Registers a converter for a specific source class.static boolean[]
remove
(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static byte[]
remove
(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static char[]
remove
(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static double[]
remove
(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static float[]
remove
(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static int[]
remove
(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static long[]
remove
(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static short[]
remove
(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static String[]
Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static <T> boolean
remove
(Collection<T> c, T valueToRemove) Removes the first occurrence of the specified value from the given collection.static <T> T[]
remove
(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static boolean[]
removeAll
(boolean[] a, boolean... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static byte[]
removeAll
(byte[] a, byte... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static char[]
removeAll
(char[] a, char... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static double[]
removeAll
(double[] a, double... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static float[]
removeAll
(float[] a, float... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static int[]
removeAll
(int[] a, int... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static long[]
removeAll
(long[] a, long... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static short[]
removeAll
(short[] a, short... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static String[]
Returns a new array with elements copied from the specified array except all occurrences of the specified values.static <T> boolean
removeAll
(Collection<T> c, Iterable<?> valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> boolean
removeAll
(Collection<T> c, Iterator<?> valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> boolean
removeAll
(Collection<T> c, T... valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> T[]
removeAll
(T[] a, T... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static boolean[]
removeAllOccurrences
(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static byte[]
removeAllOccurrences
(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static char[]
removeAllOccurrences
(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static double[]
removeAllOccurrences
(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static float[]
removeAllOccurrences
(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static int[]
removeAllOccurrences
(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static long[]
removeAllOccurrences
(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static short[]
removeAllOccurrences
(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static String[]
removeAllOccurrences
(String[] a, String valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static <T> boolean
removeAllOccurrences
(Collection<T> c, T valueToRemove) Removes all occurrences of the specified value from the given collection.static <T> T[]
removeAllOccurrences
(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static boolean[]
removeDuplicates
(boolean[] a) Returns a new array with elements from the input array but without any duplicates.static boolean[]
removeDuplicates
(boolean[] a, int fromIndex, int toIndex) Returns a new array with duplicate elements removed within the specified range.static byte[]
removeDuplicates
(byte[] a) Returns a new array with elements from the input array but without any duplicates.static byte[]
removeDuplicates
(byte[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static byte[]
removeDuplicates
(byte[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static char[]
removeDuplicates
(char[] a) Returns a new array with elements from the input array but without any duplicates.static char[]
removeDuplicates
(char[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static char[]
removeDuplicates
(char[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static double[]
removeDuplicates
(double[] a) Returns a new array with elements from the input array but without any duplicates.static double[]
removeDuplicates
(double[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static double[]
removeDuplicates
(double[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static float[]
removeDuplicates
(float[] a) Returns a new array with elements from the input array but without any duplicates.static float[]
removeDuplicates
(float[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static float[]
removeDuplicates
(float[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static int[]
removeDuplicates
(int[] a) Returns a new array with elements from the input array but without any duplicates.static int[]
removeDuplicates
(int[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static int[]
removeDuplicates
(int[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static long[]
removeDuplicates
(long[] a) Returns a new array with elements from the input array but without any duplicates.static long[]
removeDuplicates
(long[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static long[]
removeDuplicates
(long[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static short[]
removeDuplicates
(short[] a) Returns a new array with elements from the input array but without any duplicates.static short[]
removeDuplicates
(short[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static short[]
removeDuplicates
(short[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static String[]
removeDuplicates
(String[] a) Returns a new array with elements from the input array but without any duplicates.static String[]
removeDuplicates
(String[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static String[]
removeDuplicates
(String[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static boolean
removeDuplicates
(Collection<?> c) Removes duplicate elements from the given collection.static boolean
removeDuplicates
(Collection<?> c, boolean isSorted) Removes duplicate elements from the given collection.static <T> T[]
removeDuplicates
(T[] a) Returns a new array with elements from the input array but without any duplicates.static <T> T[]
removeDuplicates
(T[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static <T> T[]
removeDuplicates
(T[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with duplicate elements removed within the specified range.static <T> List
<T> repeat
(T value, int n) static <T> List
<T> repeatCollection
(Collection<T> c, int n) Repeats the entire specified Collectionn
times.static <T> List
<T> repeatCollectionToSize
(Collection<? extends T> c, int size) Repeats the entire specified Collection till reach the specified size.static <T> List
<T> repeatElements
(Collection<? extends T> c, int n) Repeats the elements in the specified Collection one by one.static <T> List
<T> repeatElementsToSize
(Collection<T> c, int size) Repeats the elements in the specified Collection one by one till reach the specified size.static int
replaceAll
(boolean[] a, boolean oldVal, boolean newVal) Replaces all occurrences of a specified boolean value in the given boolean array with another specified boolean value.static void
replaceAll
(boolean[] a, BooleanUnaryOperator operator) Replaces all elements in the given boolean array according to the provided unary operator.static int
replaceAll
(byte[] a, byte oldVal, byte newVal) Replaces all occurrences of a specified byte value in the given byte array with another specified byte value.static void
replaceAll
(byte[] a, ByteUnaryOperator operator) Replaces all elements in the given byte array according to the provided unary operator.static int
replaceAll
(char[] a, char oldVal, char newVal) Replaces all occurrences of a specified char value in the given char array with another specified char value.static void
replaceAll
(char[] a, CharUnaryOperator operator) Replaces all elements in the given char array according to the provided unary operator.static int
replaceAll
(double[] a, double oldVal, double newVal) Replaces all occurrences of a specified double value in the given double array with another specified double value.static void
replaceAll
(double[] a, DoubleUnaryOperator operator) Replaces all elements in the given double array according to the provided unary operator.static int
replaceAll
(float[] a, float oldVal, float newVal) Replaces all occurrences of a specified float value in the given float array with another specified float value.static void
replaceAll
(float[] a, FloatUnaryOperator operator) Replaces all elements in the given float array according to the provided unary operator.static int
replaceAll
(int[] a, int oldVal, int newVal) Replaces all occurrences of a specified int value in the given int array with another specified int value.static void
replaceAll
(int[] a, IntUnaryOperator operator) Replaces all elements in the given int array according to the provided unary operator.static int
replaceAll
(long[] a, long oldVal, long newVal) Replaces all occurrences of a specified long value in the given long array with another specified long value.static void
replaceAll
(long[] a, LongUnaryOperator operator) Replaces all elements in the given long array according to the provided unary operator.static int
replaceAll
(short[] a, short oldVal, short newVal) Replaces all occurrences of a specified short value in the given short array with another specified short value.static void
replaceAll
(short[] a, ShortUnaryOperator operator) Replaces all elements in the given short array according to the provided unary operator.static <T> int
replaceAll
(List<T> list, Object oldVal, T newVal) Replaces all occurrences of a specified value in the given list with another specified value.static <T> void
replaceAll
(List<T> list, UnaryOperator<T> operator) Replaces all elements in the given list according to the provided unary operator.static <T> int
replaceAll
(T[] a, Object oldVal, T newVal) Replaces all occurrences of a specified value in the given array with another specified value.static <T> void
replaceAll
(T[] a, UnaryOperator<T> operator) Replaces all elements in the given array according to the provided unary operator.static int
replaceIf
(boolean[] a, BooleanPredicate predicate, boolean newValue) Replaces all elements in the given boolean array that satisfy the provided predicate with a specified boolean value.static int
replaceIf
(byte[] a, BytePredicate predicate, byte newValue) Replaces all elements in the given byte array that satisfy the provided predicate with a specified byte value.static int
replaceIf
(char[] a, CharPredicate predicate, char newValue) Replaces all elements in the given char array that satisfy the provided predicate with a specified char value.static int
replaceIf
(double[] a, DoublePredicate predicate, double newValue) Replaces all elements in the given double array that satisfy the provided predicate with a specified double value.static int
replaceIf
(float[] a, FloatPredicate predicate, float newValue) Replaces all elements in the given float array that satisfy the provided predicate with a specified float value.static int
replaceIf
(int[] a, IntPredicate predicate, int newValue) Replaces all elements in the given int array that satisfy the provided predicate with a specified int value.static int
replaceIf
(long[] a, LongPredicate predicate, long newValue) Replaces all elements in the given long array that satisfy the provided predicate with a specified long value.static int
replaceIf
(short[] a, ShortPredicate predicate, short newValue) Replaces all elements in the given short array that satisfy the provided predicate with a specified short value.static <T> int
Replaces all elements in the given list that satisfy the provided predicate with a specified value.static <T> int
Replaces all elements in the given array that satisfy the provided predicate with a specified value.static boolean[]
replaceRange
(boolean[] a, int fromIndex, int toIndex, boolean[] replacement) Returns a new array with the specified range replaced with the replacement array.static byte[]
replaceRange
(byte[] a, int fromIndex, int toIndex, byte[] replacement) Returns a new array with the specified range replaced with the replacement array.static char[]
replaceRange
(char[] a, int fromIndex, int toIndex, char[] replacement) Returns a new array with the specified range replaced with the replacement array.static double[]
replaceRange
(double[] a, int fromIndex, int toIndex, double[] replacement) Returns a new array with the specified range replaced with the replacement array.static float[]
replaceRange
(float[] a, int fromIndex, int toIndex, float[] replacement) Returns a new array with the specified range replaced with the replacement array.static int[]
replaceRange
(int[] a, int fromIndex, int toIndex, int[] replacement) Returns a new array with the specified range replaced with the replacement array.static long[]
replaceRange
(long[] a, int fromIndex, int toIndex, long[] replacement) Returns a new array with the specified range replaced with the replacement array.static short[]
replaceRange
(short[] a, int fromIndex, int toIndex, short[] replacement) Returns a new array with the specified range replaced with the replacement array.static String[]
replaceRange
(String[] a, int fromIndex, int toIndex, String[] replacement) Returns a new array with the specified range replaced with the replacement array.static String
replaceRange
(String str, int fromIndex, int toIndex, String replacement) Returns a new String with the specified range replaced with the replacement String.static <T> boolean
replaceRange
(List<T> c, int fromIndex, int toIndex, Collection<? extends T> replacement) Replaces a range of elements in the given list with the elements from the replacement collection.static <T> T[]
replaceRange
(T[] a, int fromIndex, int toIndex, T[] replacement) Returns a new array with the specified range replaced with the replacement array.static <T> T
requireNonNull
(T obj) Ensures that the specified object reference is notnull
.static <T> T
requireNonNull
(T obj, String errorMessage) Ensures that the specified object reference is notnull
.static <T> T
requireNonNull
(T obj, Supplier<String> errorMessageSupplier) Ensures that the specified object reference is notnull
.static <T> boolean
retainAll
(Collection<T> c, Collection<? extends T> objsToKeep) Retains only the elements in the specified collection that are present in the specified collection of elements to keep.static void
reverse
(boolean[] a) Reverses the order of the given array.static void
reverse
(boolean[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(byte[] a) Reverses the order of the given array.static void
reverse
(byte[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(char[] a) Reverses the order of the given array.static void
reverse
(char[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(double[] a) Reverses the order of the given array.static void
reverse
(double[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(float[] a) Reverses the order of the given array.static void
reverse
(float[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(int[] a) Reverses the order of the given array.static void
reverse
(int[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(long[] a) Reverses the order of the given array.static void
reverse
(long[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
reverse
(short[] a) Reverses the order of the given array.static void
reverse
(short[] a, int fromIndex, int toIndex) Reverses the order of the given array in the given range.static void
Reverses the order of the given array.static void
Reverses the order of the given array in the given range.static void
reverse
(Collection<?> c) static void
static void
static void
reverseSort
(boolean[] a) static void
reverseSort
(byte[] a) static void
reverseSort
(byte[] a, int fromIndex, int toIndex) static void
reverseSort
(char[] a) static void
reverseSort
(char[] a, int fromIndex, int toIndex) static void
reverseSort
(double[] a) static void
reverseSort
(double[] a, int fromIndex, int toIndex) static void
reverseSort
(float[] a) static void
reverseSort
(float[] a, int fromIndex, int toIndex) static void
reverseSort
(int[] a) static void
reverseSort
(int[] a, int fromIndex, int toIndex) static void
reverseSort
(long[] a) static void
reverseSort
(long[] a, int fromIndex, int toIndex) static void
reverseSort
(short[] a) static void
reverseSort
(short[] a, int fromIndex, int toIndex) static void
reverseSort
(Object[] a) static void
reverseSort
(Object[] a, int fromIndex, int toIndex) static <T extends Comparable<? super T>>
voidreverseSort
(List<? extends T> list) static <T extends Comparable<? super T>>
voidreverseSort
(List<? extends T> list, int fromIndex, int toIndex) static <T,
U extends Comparable<? super U>>
voidreverseSortBy
(List<? extends T> list, Function<? super T, ? extends U> keyMapper) Reverse sort by.static <T,
U extends Comparable<? super U>>
voidreverseSortBy
(T[] a, Function<? super T, ? extends U> keyMapper) Reverse sort by.static <T> void
reverseSortByDouble
(List<? extends T> list, ToDoubleFunction<? super T> keyMapper) static <T> void
reverseSortByDouble
(T[] a, ToDoubleFunction<? super T> keyMapper) static <T> void
reverseSortByFloat
(List<? extends T> list, ToFloatFunction<? super T> keyMapper) static <T> void
reverseSortByFloat
(T[] a, ToFloatFunction<? super T> keyMapper) static <T> void
reverseSortByInt
(List<? extends T> list, ToIntFunction<? super T> keyMapper) static <T> void
reverseSortByInt
(T[] a, ToIntFunction<? super T> keyMapper) static <T> void
reverseSortByLong
(List<? extends T> list, ToLongFunction<? super T> keyMapper) static <T> void
reverseSortByLong
(T[] a, ToLongFunction<? super T> keyMapper) static <T> List
<T> reverseToList
(Collection<? extends T> c) static void
rotate
(boolean[] a, int distance) static void
rotate
(byte[] a, int distance) static void
rotate
(char[] a, int distance) static void
rotate
(double[] a, int distance) static void
rotate
(float[] a, int distance) static void
rotate
(int[] a, int distance) static void
rotate
(long[] a, int distance) static void
rotate
(short[] a, int distance) static void
static void
rotate
(Collection<?> c, int distance) static void
static <T,
E extends Exception>
voidrunByBatch
(Iterable<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes a given action on batches of elements from the providediterable
.runByBatch
(Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes a given action on batches of elements from the providediterable
.static <T,
E extends Exception>
voidrunByBatch
(Iterator<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes a given action on batches of elements from the provided iterator.runByBatch
(Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes a given action on batches of elements from the provided iterator.static <T,
E extends Exception>
voidrunByBatch
(T[] a, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes a given action on batches of elements from the provided array.runByBatch
(T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes a given action on batches of elements from the provided array.static void
runInParallel
(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2) Executes and complete the input commands in parallel.static void
runInParallel
(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3) Executes and complete the input commands in parallel.static void
runInParallel
(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4) Executes and complete the input commands in parallel.static void
runInParallel
(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4, Throwables.Runnable<? extends Exception> command5) Executes and complete the input commands in parallel.static void
runInParallel
(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes and complete the input commands in parallel.static void
runInParallel
(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes and complete the input commands in parallel.static void
runUninterruptibly
(long timeoutInMillis, Throwables.LongConsumer<InterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static void
runUninterruptibly
(long timeout, TimeUnit unit, Throwables.BiConsumer<Long, TimeUnit, InterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static void
Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static void
setAll
(boolean[] array, IntToBooleanFunction generator) Sets all elements in the given array using the provided generator function.static void
setAll
(byte[] array, IntToByteFunction generator) Sets all elements in the given array using the provided generator function.static void
setAll
(double[] array, IntToDoubleFunction generator) Sets all elements in the given array using the provided generator function.static void
setAll
(float[] array, IntToFloatFunction generator) Sets all elements in the given array using the provided generator function.static void
setAll
(int[] array, IntUnaryOperator generator) Sets all elements in the given array using the provided generator function.static void
setAll
(long[] array, IntToLongFunction generator) Sets all elements in the given array using the provided generator function.static void
setAll
(short[] array, IntToShortFunction generator) Sets all elements in the given array using the provided generator function.static <T> void
setAll
(List<T> list, IntFunction<? extends T> generator) Sets all elements in the given list using the provided generator function.static <T> void
setAll
(T[] array, IntFunction<? extends T> generator) Sets all elements in the given array using the provided generator function.static void
setPropValue
(Object bean, String propName, Object propValue) Deprecated.static void
shuffle
(boolean[] a) static void
static void
shuffle
(byte[] a) static void
static void
shuffle
(char[] a) static void
static void
shuffle
(double[] a) static void
static void
shuffle
(float[] a) static void
static void
shuffle
(int[] a) static void
static void
shuffle
(long[] a) static void
static void
shuffle
(short[] a) static void
static void
shuffle
(Collection<?> c) static void
shuffle
(Collection<?> c, Random rnd) static void
static void
static <T> void
shuffle
(T[] a) static <T> void
static int
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
size
(Collection<?> c) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static int
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.static <T> List
<T> skipRange
(Collection<? extends T> c, int startInclusive, int endExclusive) Returns a new list with the specified range skipped.static <T,
C extends Collection<T>>
CskipRange
(Collection<? extends T> c, int startInclusive, int endExclusive, IntFunction<C> supplier) Returns a new collection with the specified range skipped.static <T> T[]
skipRange
(T[] a, int startInclusive, int endExclusive) Returns a new array with the specified range skipped.static <T> List
<T> Returns a list containing the elements of the inputiterable
starting from the first element that satisfies the provided predicate.static <T> List
<T> Returns a list containing the elements of the input array starting from the first element that satisfies the provided predicate.static void
sleep
(long timeoutInMillis) Pauses the execution of the current thread for a specified time.static void
Pauses the execution of the current thread for a specified time.static void
sleepUninterruptibly
(long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static void
sleepUninterruptibly
(long timeout, TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> ImmutableCollection
<T> slice
(Collection<? extends T> c, int fromIndex, int toIndex) Returns a read-only slice of the input collection from the specified start index to the end index.static <T> ObjIterator
<T> Returns a read-only slice of the input iterator from the specified start index to the end index.static <T> ImmutableList
<T> Returns a read-only slice of the input list from the specified start index to the end index.static <T> ImmutableList
<T> slice
(T[] a, int fromIndex, int toIndex) Returns a read-only slice of the input array from the specified start index to the end index.static void
sort
(boolean[] a) static void
sort
(byte[] a) static void
sort
(byte[] a, int fromIndex, int toIndex) static void
sort
(char[] a) static void
sort
(char[] a, int fromIndex, int toIndex) static void
sort
(double[] a) static void
sort
(double[] a, int fromIndex, int toIndex) static void
sort
(float[] a) static void
sort
(float[] a, int fromIndex, int toIndex) static void
sort
(int[] a) static void
sort
(int[] a, int fromIndex, int toIndex) static void
sort
(long[] a) static void
sort
(long[] a, int fromIndex, int toIndex) static void
sort
(short[] a) static void
sort
(short[] a, int fromIndex, int toIndex) static void
static void
static <T extends Comparable<? super T>>
voidstatic <T extends Comparable<? super T>>
voidstatic <T> void
sort
(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> void
sort
(List<? extends T> list, Comparator<? super T> cmp) static <T> void
sort
(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) static <T> void
sort
(T[] a, Comparator<? super T> cmp) static <T,
U extends Comparable<? super U>>
voidstatic <T,
U extends Comparable<? super U>>
voidstatic <T> void
sortByDouble
(List<? extends T> list, ToDoubleFunction<? super T> keyMapper) Sort by double.static <T> void
sortByDouble
(T[] a, ToDoubleFunction<? super T> keyMapper) Sort by double.static <T> void
sortByFloat
(List<? extends T> list, ToFloatFunction<? super T> keyMapper) Sort by float.static <T> void
sortByFloat
(T[] a, ToFloatFunction<? super T> keyMapper) Sort by float.static <T> void
sortByInt
(List<? extends T> list, ToIntFunction<? super T> keyMapper) Sort by int.static <T> void
sortByInt
(T[] a, ToIntFunction<? super T> keyMapper) Sort by int.static <T> void
sortByLong
(List<? extends T> list, ToLongFunction<? super T> keyMapper) Sort by long.static <T> void
sortByLong
(T[] a, ToLongFunction<? super T> keyMapper) Sort by long.static List
<boolean[]> split
(boolean[] a, int chunkSize) Splits the input boolean array into sub-arrays of the specified size.static List
<boolean[]> split
(boolean[] a, int fromIndex, int toIndex, int chunkSize) Splits the input boolean array into sub-arrays of the specified size.static List
<byte[]> split
(byte[] a, int chunkSize) Splits the input byte array into sub-arrays of the specified size.static List
<byte[]> split
(byte[] a, int fromIndex, int toIndex, int chunkSize) Splits the input byte array into sub-arrays of the specified size.static List
<char[]> split
(char[] a, int chunkSize) Splits the input char array into sub-arrays of the specified size.static List
<char[]> split
(char[] a, int fromIndex, int toIndex, int chunkSize) Splits the input char array into sub-arrays of the specified size.static List
<double[]> split
(double[] a, int chunkSize) Splits the input double array into sub-arrays of the specified size.static List
<double[]> split
(double[] a, int fromIndex, int toIndex, int chunkSize) Splits the input double array into sub-arrays of the specified size.static List
<float[]> split
(float[] a, int chunkSize) Splits the input float array into sub-arrays of the specified size.static List
<float[]> split
(float[] a, int fromIndex, int toIndex, int chunkSize) Splits the input float array into sub-arrays of the specified size.static List
<int[]> split
(int[] a, int chunkSize) Splits the input int array into sub-arrays of the specified size.static List
<int[]> split
(int[] a, int fromIndex, int toIndex, int chunkSize) Splits the input int array into sub-arrays of the specified size.static List
<long[]> split
(long[] a, int chunkSize) Splits the input long array into sub-arrays of the specified size.static List
<long[]> split
(long[] a, int fromIndex, int toIndex, int chunkSize) Splits the input long array into sub-arrays of the specified size.static List
<short[]> split
(short[] a, int chunkSize) Splits the input short array into sub-arrays of the specified size.static List
<short[]> split
(short[] a, int fromIndex, int toIndex, int chunkSize) Splits the input short array into sub-arrays of the specified size.split
(CharSequence str, int chunkSize) Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnull
or empty.split
(CharSequence str, int fromIndex, int toIndex, int chunkSize) Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnull
or empty.Splits the inputiterable
into sub-collections of the specified size.split
(Collection<? extends T> c, int chunkSize) Splits the input collection into sub-collections of the specified size.split
(Collection<? extends T> c, int fromIndex, int toIndex, int chunkSize) Splits the input collection into sub-collections of the specified size.static <T> ObjIterator
<List<T>> Splits the input iterator into sub-collections of the specified size.static <T> List
<T[]> split
(T[] a, int chunkSize) Splits the input array into sub-arrays of the specified size.static <T> List
<T[]> split
(T[] a, int fromIndex, int toIndex, int chunkSize) Splits the input array into sub-arrays of the specified size.static <T> List
<T> splitByChunkCount
(int totalSize, int maxChunkCount, boolean sizeSmallerFirst, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.static <T> List
<T> splitByChunkCount
(int totalSize, int maxChunkCount, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.splitByChunkCount
(Collection<? extends T> c, int maxChunkCount) Splits the input collection into sub-lists based on the specified maximum chunk count.splitByChunkCount
(Collection<? extends T> c, int maxChunkCount, boolean sizeSmallerFirst) Splits the input collection into sub-lists based on the specified maximum chunk count.static <T> CheckedStream
<T, IOException> streamJson
(File jsonArray, JSONDeserializationConfig config, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(File jsonArray, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(InputStream jsonArray, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(Reader jsonArray, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(String jsonArray, JSONDeserializationConfig config, Class<? extends T> elementClass) static <T> CheckedStream
<T, IOException> streamJson
(String jsonArray, Class<? extends T> elementClass) static String
stringOf
(boolean val) Converts the given value to its corresponding String representation.static String
stringOf
(byte val) Converts the given value to its corresponding String representation.static String
stringOf
(char val) Converts the given value to its corresponding String representation.static String
stringOf
(double val) Converts the given value to its corresponding String representation.static String
stringOf
(float val) Converts the given value to its corresponding String representation.static String
stringOf
(int val) Converts the given value to its corresponding String representation.static String
stringOf
(long val) Converts the given value to its corresponding String representation.static String
stringOf
(short val) Converts the given value to its corresponding String representation.static String
Converts the given value to its corresponding String representation.static int
sum
(byte... a) Calculates the sum of the bytes in the given array.static int
sum
(byte[] a, int fromIndex, int toIndex) Calculates the sum of the bytes in the given array within the specified range.static int
sum
(char... a) Calculates the sum of the given array of characters.static int
sum
(char[] a, int fromIndex, int toIndex) Calculates the sum of the ASCII values of the characters in the given array within the specified range.static double
sum
(double... a) static double
sum
(double[] a, int fromIndex, int toIndex) static float
sum
(float... a) static float
sum
(float[] a, int fromIndex, int toIndex) static int
sum
(int... a) static int
sum
(int[] a, int fromIndex, int toIndex) static long
sum
(long... a) static long
sum
(long[] a, int fromIndex, int toIndex) static int
sum
(short... a) static int
sum
(short[] a, int fromIndex, int toIndex) static BigDecimal
sumBigDecimal
(Iterable<? extends BigDecimal> c) Sums the BigDecimal values in the provided iterable.static <T> BigDecimal
sumBigDecimal
(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Returns the sum of the BigDecimal values extracted from the elements in the provided iterable by the inputfunc
function.static BigInteger
sumBigInteger
(Iterable<? extends BigInteger> c) Sums the BigInteger values in the provided iterable.static <T> BigInteger
sumBigInteger
(Iterable<? extends T> c, Function<? super T, BigInteger> func) Returns the sum of the BigInteger values extracted from the elements in the provided iterable by the inputfunc
function.static <T extends Number>
doublestatic <T> double
sumDouble
(Iterable<? extends T> c, ToDoubleFunction<? super T> func) static <T extends Number>
doublesumDouble
(Collection<? extends T> c, int fromIndex, int toIndex) static <T> double
sumDouble
(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) static <T extends Number>
doublesumDouble
(T[] a) static <T extends Number>
doublesumDouble
(T[] a, int fromIndex, int toIndex) static <T> double
sumDouble
(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) static <T> double
sumDouble
(T[] a, ToDoubleFunction<? super T> func) static <T extends Number>
intstatic <T> int
sumInt
(Iterable<? extends T> c, ToIntFunction<? super T> func) static <T extends Number>
intsumInt
(Collection<? extends T> c, int fromIndex, int toIndex) static <T> int
sumInt
(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) static <T extends Number>
intsumInt
(T[] a) static <T extends Number>
intsumInt
(T[] a, int fromIndex, int toIndex) static <T> int
sumInt
(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) static <T> int
sumInt
(T[] a, ToIntFunction<? super T> func) static <T extends Number>
longsumIntToLong
(Iterable<? extends T> c) static <T> long
sumIntToLong
(Iterable<? extends T> c, ToIntFunction<? super T> func) static <T extends Number>
longstatic <T> long
sumLong
(Iterable<? extends T> c, ToLongFunction<? super T> func) static <T extends Number>
longsumLong
(Collection<? extends T> c, int fromIndex, int toIndex) static <T> long
sumLong
(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) static <T extends Number>
longsumLong
(T[] a) static <T extends Number>
longsumLong
(T[] a, int fromIndex, int toIndex) static <T> long
sumLong
(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) static <T> long
sumLong
(T[] a, ToLongFunction<? super T> func) static double
sumToDouble
(float... a) static double
sumToDouble
(float[] a, int fromIndex, int toIndex) static long
sumToLong
(int... a) static long
sumToLong
(int[] a, int fromIndex, int toIndex) static void
swap
(boolean[] a, int i, int j) static void
swap
(byte[] a, int i, int j) static void
swap
(char[] a, int i, int j) static void
swap
(double[] a, int i, int j) static void
swap
(float[] a, int i, int j) static void
swap
(int[] a, int i, int j) static void
swap
(long[] a, int i, int j) static void
swap
(short[] a, int i, int j) static <T> void
static <T,
M> void static void
static void
static <T> boolean
static <T,
M> boolean static boolean[]
symmetricDifference
(boolean[] a, boolean[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static byte[]
symmetricDifference
(byte[] a, byte[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static char[]
symmetricDifference
(char[] a, char[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static double[]
symmetricDifference
(double[] a, double[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static float[]
symmetricDifference
(float[] a, float[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static int[]
symmetricDifference
(int[] a, int[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static long[]
symmetricDifference
(long[] a, long[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static short[]
symmetricDifference
(short[] a, short[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static <T> List
<T> symmetricDifference
(Collection<? extends T> a, Collection<? extends T> b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static <T> List
<T> symmetricDifference
(T[] a, T[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa.static <T> List
<T> Returns a list containing the elements of the inputiterable
until the provided predicate returnsfalse
.static <T> List
<T> Returns a list containing the elements of the input array until the provided predicate returnsfalse
.static <T> List
<T> takeWhileInclusive
(Iterable<? extends T> c, Predicate<? super T> filter) Returns a list containing the elements of the inputiterable
until the provided predicate returnsfalse
, including the element that fails the predicate.static <T> List
<T> takeWhileInclusive
(T[] a, Predicate<? super T> filter) Returns a list containing the elements of the input array until the provided predicate returnsfalse
, including the element that fails the predicate.static Object[]
toArray
(Collection<?> c) Returns an empty array if the specified collection isnull
or empty.static Object[]
toArray
(Collection<?> c, int fromIndex, int toIndex) Converts the specified range in the specified collection into an array.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, int fromIndex, int toIndex, A[] a) Converts the specified range in the specified collection into an array.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, int fromIndex, int toIndex, Class<A[]> targetType) Converts the specified range in the specified collection into an array of a specified type.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, int fromIndex, int toIndex, IntFunction<A[]> arraySupplier) Converts the specified range in the specified collection into an array using a provided array supplier function.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, A[] a) Converts a collection into an array.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, Class<A[]> targetType) Converts a collection into an array of a specified type.static <A,
T extends A>
A[]toArray
(Collection<? extends T> c, IntFunction<A[]> arraySupplier) Converts a collection into an array using a provided array supplier function.static boolean[]
toBooleanArray
(byte[] a) Converts a byte array to a boolean array.static boolean[]
toBooleanArray
(int[] a) Converts an int array to a boolean array.static boolean[]
To boolean array.static boolean[]
toBooleanArray
(Collection<Boolean> c, boolean defaultForNull) To boolean array.static boolean[]
toBooleanArray
(Collection<Boolean> c, int fromIndex, int toIndex) To boolean array.static boolean[]
toBooleanArray
(Collection<Boolean> c, int fromIndex, int toIndex, boolean defaultForNull) To boolean array.static byte[]
toByteArray
(boolean[] a) Converts a boolean array to a byte array.static byte[]
toByteArray
(Collection<? extends Number> c) To byte array.static byte[]
toByteArray
(Collection<? extends Number> c, byte defaultForNull) To byte array.static byte[]
toByteArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To byte array.static byte[]
toByteArray
(Collection<? extends Number> c, int fromIndex, int toIndex, byte defaultForNull) To byte array.static char[]
To char array.static char[]
toCharArray
(Collection<Character> c, char defaultForNull) To char array.static char[]
toCharArray
(Collection<Character> c, int fromIndex, int toIndex) To char array.static char[]
toCharArray
(Collection<Character> c, int fromIndex, int toIndex, char defaultForNull) To char array.static <C extends Collection<Boolean>>
CtoCollection
(boolean[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Boolean>>
CtoCollection
(boolean[] a, IntFunction<? extends C> supplier) static <C extends Collection<Byte>>
CtoCollection
(byte[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Byte>>
CtoCollection
(byte[] a, IntFunction<? extends C> supplier) static <C extends Collection<Character>>
CtoCollection
(char[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Character>>
CtoCollection
(char[] a, IntFunction<? extends C> supplier) static <C extends Collection<Double>>
CtoCollection
(double[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Double>>
CtoCollection
(double[] a, IntFunction<? extends C> supplier) static <C extends Collection<Float>>
CtoCollection
(float[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Float>>
CtoCollection
(float[] a, IntFunction<? extends C> supplier) static <C extends Collection<Integer>>
CtoCollection
(int[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Integer>>
CtoCollection
(int[] a, IntFunction<? extends C> supplier) static <C extends Collection<Long>>
CtoCollection
(long[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Long>>
CtoCollection
(long[] a, IntFunction<? extends C> supplier) static <C extends Collection<Short>>
CtoCollection
(short[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <C extends Collection<Short>>
CtoCollection
(short[] a, IntFunction<? extends C> supplier) static <T,
C extends Collection<T>>
CtoCollection
(Iterable<? extends T> c, IntFunction<? extends C> supplier) static <T,
C extends Collection<T>>
CtoCollection
(Iterator<? extends T> iter, Supplier<? extends C> supplier) static <T,
C extends Collection<T>>
CtoCollection
(T[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) static <T,
C extends Collection<T>>
CtoCollection
(T[] a, IntFunction<? extends C> supplier) static double[]
toDoubleArray
(Collection<? extends Number> c) To double array.static double[]
toDoubleArray
(Collection<? extends Number> c, double defaultForNull) To double array.static double[]
toDoubleArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To double array.static double[]
toDoubleArray
(Collection<? extends Number> c, int fromIndex, int toIndex, double defaultForNull) To double array.static float[]
toFloatArray
(Collection<? extends Number> c) To float array.static float[]
toFloatArray
(Collection<? extends Number> c, float defaultForNull) To float array.static float[]
toFloatArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To float array.static float[]
toFloatArray
(Collection<? extends Number> c, int fromIndex, int toIndex, float defaultForNull) To float array.static int[]
toIntArray
(boolean[] a) Converts a boolean array to an int array.static int[]
toIntArray
(char[] a) Converts a char array to an int array.static int[]
toIntArray
(Collection<? extends Number> c) To int array.static int[]
toIntArray
(Collection<? extends Number> c, int defaultForNull) To int array.static int[]
toIntArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To int array.static int[]
toIntArray
(Collection<? extends Number> c, int fromIndex, int toIndex, int defaultForNull) To int array.static String
Converts the given object into a JSON string.static String
Converts the given object into a JSON string with optional pretty formatting.static String
toJson
(Object obj, JSONSerializationConfig config) static void
toJson
(Object obj, JSONSerializationConfig config, File output) static void
toJson
(Object obj, JSONSerializationConfig config, OutputStream output) static void
toJson
(Object obj, JSONSerializationConfig config, Writer output) static void
static void
toJson
(Object obj, OutputStream output) static void
toList
(boolean[] a) toList
(boolean[] a, int fromIndex, int toIndex) toList
(byte[] a) toList
(byte[] a, int fromIndex, int toIndex) toList
(char[] a) toList
(char[] a, int fromIndex, int toIndex) toList
(double[] a) toList
(double[] a, int fromIndex, int toIndex) toList
(float[] a) toList
(float[] a, int fromIndex, int toIndex) toList
(int[] a) toList
(int[] a, int fromIndex, int toIndex) toList
(long[] a) toList
(long[] a, int fromIndex, int toIndex) toList
(short[] a) toList
(short[] a, int fromIndex, int toIndex) static <T> List
<T> static <T> List
<T> toList
(T[] a) static <T> List
<T> toList
(T[] a, int fromIndex, int toIndex) static long[]
toLongArray
(Collection<? extends Number> c) To long array.static long[]
toLongArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To long array.static long[]
toLongArray
(Collection<? extends Number> c, int fromIndex, int toIndex, long defaultForNull) To long array.static long[]
toLongArray
(Collection<? extends Number> c, long defaultForNull) To long array.static <T,
K> Map <K, T> static <T,
K, V> Map <K, V> toMap
(Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor) static <T,
K, V, M extends Map<K, V>>
MtoMap
(Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, IntFunction<? extends M> mapSupplier) static <T,
K, V, M extends Map<K, V>>
MtoMap
(Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) static <T,
K> Map <K, T> static <T,
K, V> Map <K, V> toMap
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor) static <T,
K, V, M extends Map<K, V>>
MtoMap
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, Supplier<? extends M> mapSupplier) static <T,
K, V, M extends Map<K, V>>
MtoMap
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, Supplier<? extends M> mapSupplier) static double[]
top
(double[] a, int n) Returns the top n elements from the provided array.static double[]
top
(double[] a, int fromIndex, int toIndex, int n) Returns the top n elements from the provided array, based on their natural ordering.static double[]
top
(double[] a, int fromIndex, int toIndex, int n, Comparator<? super Double> cmp) Returns the top n elements from the provided array, based on the provided comparator.static double[]
top
(double[] a, int n, Comparator<? super Double> cmp) Returns the top n elements from the provided array.static float[]
top
(float[] a, int n) Returns the top n elements from the provided array.static float[]
top
(float[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.static float[]
top
(float[] a, int fromIndex, int toIndex, int n, Comparator<? super Float> cmp) Returns the top n elements from a specified range of the array, sorted according to the provided comparator.static float[]
top
(float[] a, int n, Comparator<? super Float> cmp) Returns the top n elements from the provided array.static int[]
top
(int[] a, int n) Returns the top n elements from the provided array.static int[]
top
(int[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.static int[]
top
(int[] a, int fromIndex, int toIndex, int n, Comparator<? super Integer> cmp) Returns the top n elements from a specified range of the array, sorted according to the provided comparator.static int[]
top
(int[] a, int n, Comparator<? super Integer> cmp) Returns the top n elements from the provided array.static long[]
top
(long[] a, int n) Returns the top n elements from the provided array.static long[]
top
(long[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.static long[]
top
(long[] a, int fromIndex, int toIndex, int n, Comparator<? super Long> cmp) Returns the top n elements from a specified range of the array, sorted according to the provided comparator.static long[]
top
(long[] a, int n, Comparator<? super Long> cmp) Returns the top n elements from the provided array.static short[]
top
(short[] a, int n) Returns the top n elements from the provided array.static short[]
top
(short[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.static short[]
top
(short[] a, int fromIndex, int toIndex, int n, Comparator<? super Short> cmp) Returns the top n elements from a specified range of the array, sorted according to the provided comparator.static short[]
top
(short[] a, int n, Comparator<? super Short> cmp) Returns the top n elements from the provided array.static <T extends Comparable<? super T>>
List<T> top
(Collection<? extends T> c, int n) Returns the top n elements from the provided collection, based on natural ordering of the elements.static <T extends Comparable<? super T>>
List<T> top
(Collection<? extends T> c, int n, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the natural ordering of the elements.static <T extends Comparable<? super T>>
List<T> top
(Collection<? extends T> c, int fromIndex, int toIndex, int n) Returns the top n elements from the provided collection, based on natural ordering of the elements.static <T extends Comparable<? super T>>
List<T> top
(Collection<? extends T> c, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the natural ordering of the elements.static <T> List
<T> top
(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) Returns the top n elements from the provided collection, based on the provided comparator.static <T> List
<T> top
(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the provided comparator.static <T> List
<T> top
(Collection<? extends T> c, int n, Comparator<? super T> cmp) Returns the top n elements from the provided collection, based on the provided comparator.static <T> List
<T> top
(Collection<? extends T> c, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the provided comparator.static <T extends Comparable<? super T>>
List<T> top
(T[] a, int n) Returns the top n elements from the provided array.static <T extends Comparable<? super T>>
List<T> top
(T[] a, int n, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on natural ordering of the elements.static <T extends Comparable<? super T>>
List<T> top
(T[] a, int fromIndex, int toIndex, int n) Returns the top n elements from the provided array, based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top
(T[] a, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on the natural ordering of the elements.static <T> List
<T> top
(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) Returns the top n elements from the provided array, based on the provided comparator.static <T> List
<T> top
(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on the provided comparator.static <T> List
<T> top
(T[] a, int n, Comparator<? super T> cmp) Returns the top n elements from the provided array.static <T> List
<T> top
(T[] a, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on the provided comparator.static RuntimeException
Converts the provided exception to a runtime exception.static RuntimeException
Converts the specifiedThrowable
to aRuntimeException
if it's a checkedexception
or anError
, otherwise returns itself.static RuntimeException
toRuntimeException
(Throwable e, boolean throwIfItIsError) Converts the specifiedThrowable
to aRuntimeException
if it's a checkedexception
, or throw it if it's anError
.toSet
(boolean[] a) toSet
(boolean[] a, int fromIndex, int toIndex) toSet
(byte[] a) toSet
(byte[] a, int fromIndex, int toIndex) toSet
(char[] a) toSet
(char[] a, int fromIndex, int toIndex) toSet
(double[] a) toSet
(double[] a, int fromIndex, int toIndex) toSet
(float[] a) toSet
(float[] a, int fromIndex, int toIndex) toSet
(int[] a) toSet
(int[] a, int fromIndex, int toIndex) toSet
(long[] a) toSet
(long[] a, int fromIndex, int toIndex) toSet
(short[] a) toSet
(short[] a, int fromIndex, int toIndex) static <T> Set
<T> static <T> Set
<T> toSet
(T[] a) static <T> Set
<T> toSet
(T[] a, int fromIndex, int toIndex) static short[]
toShortArray
(Collection<? extends Number> c) To short array.static short[]
toShortArray
(Collection<? extends Number> c, int fromIndex, int toIndex) To short array.static short[]
toShortArray
(Collection<? extends Number> c, int fromIndex, int toIndex, short defaultForNull) To short array.static short[]
toShortArray
(Collection<? extends Number> c, short defaultForNull) To short array.static String
toString
(boolean value) static String
toString
(boolean[] a) static String
toString
(boolean[] a, int fromIndex, int toIndex) static String
toString
(byte value) static String
toString
(byte[] a) static String
toString
(byte[] a, int fromIndex, int toIndex) static String
toString
(char value) static String
toString
(char[] a) static String
toString
(char[] a, int fromIndex, int toIndex) static String
toString
(double value) static String
toString
(double[] a) static String
toString
(double[] a, int fromIndex, int toIndex) static String
toString
(float value) static String
toString
(float[] a) static String
toString
(float[] a, int fromIndex, int toIndex) static String
toString
(int value) static String
toString
(int[] a) static String
toString
(int[] a, int fromIndex, int toIndex) static String
toString
(long value) static String
toString
(long[] a) static String
toString
(long[] a, int fromIndex, int toIndex) static String
toString
(short value) static String
toString
(short[] a) static String
toString
(short[] a, int fromIndex, int toIndex) static String
static String
static String
static String
static String
Converts the given object into an XML string.static String
Converts the given object into an XML string with optional pretty formatting.static String
toXml
(Object obj, XMLSerializationConfig config) static void
toXml
(Object obj, XMLSerializationConfig config, File output) static void
toXml
(Object obj, XMLSerializationConfig config, OutputStream output) static void
toXml
(Object obj, XMLSerializationConfig config, Writer output) static void
static void
toXml
(Object obj, OutputStream output) static void
static <R> R
tryOrDefaultIfExceptionOccurred
(Callable<R> cmd, Supplier<R> supplierForDefaultIfExceptionOccurred) Returns the value returned byaction
or{@code supplierForDefaultIfExceptionOccurred}
if exception happens.static <R> R
tryOrDefaultIfExceptionOccurred
(Callable<R> cmd, R defaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.static <T,
R> R tryOrDefaultIfExceptionOccurred
(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, Supplier<R> supplierForDefaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.static <T,
R> R tryOrDefaultIfExceptionOccurred
(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, R defaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.static <R> u.Nullable
<R> Returns aNullable
with the value returned byaction
or an emptyNullable
if exception happens.static <T,
R> u.Nullable <R> tryOrEmptyIfExceptionOccurred
(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func) Returns aNullable
with the value returned byfunc.apply(init)
or an emptyNullable
if exception happens.static <T> com.landawn.abacus.type.Type
<T> Gets a Type by the givenClass
.static <T> com.landawn.abacus.type.Type
<T> Gets a Type by the given type name.static <T> Collection
<T> unmodifiableCollection
(Collection<? extends T> c) Returns anunmodifiable view
of the specifiedCollection
.static <T> List
<T> unmodifiableList
(List<? extends T> list) Returns anunmodifiable view
of the specifiedList
.static <K,
V> Map <K, V> unmodifiableMap
(Map<? extends K, ? extends V> m) Returns anunmodifiable view
of the specifiedMap
.static <K,
V> NavigableMap <K, V> unmodifiableNavigableMap
(NavigableMap<K, ? extends V> m) Returns anunmodifiable view
of the specifiedNavigableMap
.static <T> NavigableSet
<T> Returns anunmodifiable view
of the specifiedNavigableSet
.static <T> Set
<T> unmodifiableSet
(Set<? extends T> s) Returns anunmodifiable view
of the specifiedSet
.static <K,
V> SortedMap <K, V> unmodifiableSortedMap
(SortedMap<K, ? extends V> m) Returns anunmodifiable view
of the specifiedSortedMap
.static <T> SortedSet
<T> Returns anunmodifiable view
of the specifiedSortedSet
.unzip
(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip) static <T,
A, B, LC extends Collection<A>, RC extends Collection<B>>
Pair<LC, RC> unzip
(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip, IntFunction<? extends Collection<?>> supplier) unzipp
(Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)
static <T,
A, B, C, LC extends Collection<A>, MC extends Collection<B>, RC extends Collection<C>>
Triple<LC, MC, RC> unzipp
(Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip, IntFunction<? extends Collection<?>> supplier) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)
static void
Deprecated.usereplaceAll
static void
Deprecated.usereplaceIf
static <T> T
Converts the given string to its corresponding value of the specified target type.static String
Xml 2 JSO.static String
Xml 2 JSO.static <A,
B, R> List <R> zip
(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) static <A,
B, R> R[] zip
(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) static <A,
B, C, R>
List<R> zip
(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) static <A,
B, C, R>
R[]zip
(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) static <A,
B, C, R>
List<R> zip
(A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) static <A,
B, C, R>
R[]zip
(A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) static <A,
B, R> List <R> zip
(A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction) static <A,
B, R> R[] zip
(A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) static <A,
B, R> List <R> zip
(Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) static <A,
B, C, R>
List<R> zip
(Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) static <A,
B, C, R>
List<R> zip
(Iterable<A> a, Iterable<B> b, Iterable<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) static <A,
B, R> List <R> zip
(Iterable<A> a, Iterable<B> b, BiFunction<? super A, ? super B, ? extends R> zipFunction)
-
Field Details
-
INDEX_NOT_FOUND
public static final int INDEX_NOT_FOUNDThe index value when an element is not found in a list or array:-1
. This value is returned by methods in this class and can also be used in comparisons with values returned by various method fromList
.- See Also:
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAYAn empty immutable/unmodifiableboolean
array. -
EMPTY_CHAR_ARRAY
public static final char[] EMPTY_CHAR_ARRAYAn empty immutable/unmodifiablechar
array. -
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAYAn empty immutable/unmodifiablebyte
array. -
EMPTY_SHORT_ARRAY
public static final short[] EMPTY_SHORT_ARRAYAn empty immutable/unmodifiableshort
array. -
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAYAn empty immutable/unmodifiableint
array. -
EMPTY_LONG_ARRAY
public static final long[] EMPTY_LONG_ARRAYAn empty immutable/unmodifiablelong
array. -
EMPTY_FLOAT_ARRAY
public static final float[] EMPTY_FLOAT_ARRAYAn empty immutable/unmodifiablefloat
array. -
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAYAn empty immutable/unmodifiabledouble
array. -
EMPTY_BOOLEAN_OBJ_ARRAY
An empty immutable/unmodifiableBoolean
array. -
EMPTY_CHAR_OBJ_ARRAY
An empty immutable/unmodifiableCharacter
array. -
EMPTY_BYTE_OBJ_ARRAY
An empty immutable/unmodifiableByte
array. -
EMPTY_SHORT_OBJ_ARRAY
An empty immutable/unmodifiableShort
array. -
EMPTY_INT_OBJ_ARRAY
An empty immutable/unmodifiableInteger
array. -
EMPTY_LONG_OBJ_ARRAY
An empty immutable/unmodifiableLong
array. -
EMPTY_FLOAT_OBJ_ARRAY
An empty immutable/unmodifiableFloat
array. -
EMPTY_DOUBLE_OBJ_ARRAY
An empty immutable/unmodifiableDouble
array. -
EMPTY_BIG_INTEGER_ARRAY
An empty immutable/unmodifiableBigInteger
array. -
EMPTY_BIG_DECIMAL_ARRAY
An empty immutable/unmodifiableBigDecimal
array. -
EMPTY_STRING_ARRAY
An empty immutable/unmodifiableString
array. -
EMPTY_JU_DATE_ARRAY
An empty immutable/unmodifiablejava.util.Date
array. -
EMPTY_DATE_ARRAY
An empty immutable/unmodifiablejava.sql.Date
array. -
EMPTY_TIME_ARRAY
An empty immutable/unmodifiableTime
array. -
EMPTY_TIMESTAMP_ARRAY
An empty immutable/unmodifiableTimestamp
array. -
EMPTY_CALENDAR_ARRAY
/** An empty immutable/unmodifiableCalendar
array. -
EMPTY_LOCAL_DATE_ARRAY
/** An empty immutable/unmodifiableLocalDate
array. -
EMPTY_LOCAL_TIME_ARRAY
/** An empty immutable/unmodifiableLocalTime
array. -
EMPTY_LOCAL_DATE_TIME_ARRAY
/** An empty immutable/unmodifiableLocalDateTime
array. -
EMPTY_OBJECT_ARRAY
An empty immutable/unmodifiableObject
array.
-
-
Method Details
-
occurrencesOf
public static int occurrencesOf(boolean[] a, boolean valueToFind) Counts the occurrences of a specific boolean value in a boolean array.- Parameters:
a
- The boolean array to be checked for the presence of the valueToFind.valueToFind
- The boolean value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(char[] a, char valueToFind) Counts the occurrences of a specific char value in a char array.- Parameters:
a
- The char array to be checked for the presence of the valueToFind.valueToFind
- The char value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(byte[] a, byte valueToFind) Counts the occurrences of a specific byte value in a byte array.- Parameters:
a
- The byte array to be checked for the presence of the valueToFind.valueToFind
- The byte value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(short[] a, short valueToFind) Counts the occurrences of a specific short value in a short array.- Parameters:
a
- The short array to be checked for the presence of the valueToFind.valueToFind
- The short value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(int[] a, int valueToFind) Counts the occurrences of a specific int value in a int array.- Parameters:
a
- The int array to be checked for the presence of the valueToFind.valueToFind
- The int value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(long[] a, long valueToFind) Counts the occurrences of a specific long value in a long array.- Parameters:
a
- The long array to be checked for the presence of the valueToFind.valueToFind
- The long value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(float[] a, float valueToFind) Counts the occurrences of a specific float value in a float array.- Parameters:
a
- The float array to be checked for the presence of the valueToFind.valueToFind
- The float value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
public static int occurrencesOf(double[] a, double valueToFind) Counts the occurrences of a specific double value in a double array.- Parameters:
a
- The double array to be checked for the presence of the valueToFind.valueToFind
- The double value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
Counts the occurrences of a specific Object value in an Object array.- Parameters:
a
- The Object array to be checked for the presence of the valueToFind.valueToFind
- The Object value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
null
or empty.
-
occurrencesOf
Counts the occurrences of a specific Object value in anIterable
.- Parameters:
c
- TheIterable
to be checked for the presence of the valueToFind.valueToFind
- The Object value to be checked for its occurrences in theIterable
c.- Returns:
- The number of occurrences of valueToFind in
Iterable
c. Returns 0 if theIterable
isnull
.
-
occurrencesOf
Counts the occurrences of a specific Object value in anIterator
.- Parameters:
iter
- TheIterator
to be checked for the presence of the valueToFind.valueToFind
- The Object value to be checked for its occurrences in the Iterator iter.- Returns:
- The number of occurrences of valueToFind in Iterator iter. Returns 0 if the Iterator is
null
. - Throws:
ArithmeticException
- if the number of occurrences exceeds Integer.MAX_VALUE.- See Also:
-
occurrencesOf
Counts the occurrences of a specific character in a String.- Parameters:
str
- The String to be checked for the presence of the valueToFind.valueToFind
- The character to be checked for its occurrences in the String str.- Returns:
- The number of occurrences of valueToFind in String str. Returns 0 if the String is
null
or empty. - See Also:
-
occurrencesOf
Counts the occurrences of a specific String value in another String.- Parameters:
str
- The String to be checked for the presence of the valueToFind.valueToFind
- The String value to be checked for its occurrences in the String str.- Returns:
- The number of occurrences of valueToFind in String str. Returns 0 if the String is
null
or empty. - See Also:
-
occurrencesMap
Returns a map with the occurrences of each element in the given array. The map's keys are the distinct elements in the array, and their corresponding values are the number of occurrences of each element. If the input array isnull
or empty, an empty map is returned.- Type Parameters:
T
- the type of elements in the array- Parameters:
a
- the array to count occurrences from- Returns:
- a Map containing the elements of the array as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given array. The map's keys are the distinct elements in the array, and their corresponding values are the number of occurrences of each element. If the input array isnull
or empty, a map provided by the supplied map supplier is returned.- Type Parameters:
T
- the type of elements in the array- Parameters:
a
- the array to count occurrences frommapSupplier
- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the array as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given iterable collection. The map's keys are the distinct elements in the collection, and their corresponding values are the number of occurrences of each element. If the input collection isnull
, an empty map is returned.- Type Parameters:
T
- the type of elements in the collection- Parameters:
c
- the collection to count occurrences from- Returns:
- a Map containing the elements of the collection as keys and their occurrences as values
-
occurrencesMap
public static <T> Map<T,Integer> occurrencesMap(Iterable<? extends T> c, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterable collection. The map's keys are the distinct elements in the collection, and their corresponding values are the number of occurrences of each element. If the input collection isnull
, a map provided by the supplied map supplier is returned.- Type Parameters:
T
- the type of elements in the collection- Parameters:
c
- the collection to count occurrences frommapSupplier
- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the collection as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given iterator. The map's keys are the distinct elements in the iterator, and their corresponding values are the number of occurrences of each element. If the input iterator isnull
or empty, an empty map is returned.- Type Parameters:
T
- the type of elements in the iterator- Parameters:
iter
- the iterator to count occurrences from- Returns:
- a Map containing the elements of the iterator as keys and their occurrences as values
-
occurrencesMap
public static <T> Map<T,Integer> occurrencesMap(Iterator<? extends T> iter, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterator. The map's keys are the distinct elements in the iterator, and their corresponding values are the number of occurrences of each element. If the input iterator isnull
or empty, a map provided by the supplied map supplier is returned.- Type Parameters:
T
- the type of elements in the iterator- Parameters:
iter
- the iterator to count occurrences frommapSupplier
- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the iterator as keys and their occurrences as values
-
contains
public static boolean contains(boolean[] a, boolean valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(char[] a, char valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(byte[] a, byte valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(short[] a, short valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(int[] a, int valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(long[] a, long valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(float[] a, float valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
public static boolean contains(double[] a, double valueToFind) Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
Checks if the specified array contains the specified value.- Parameters:
a
- The array to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
if a isnull
or empty orvalueToFind
is not found.
-
contains
Checks if the specified Collection contains the specified value.- Parameters:
c
- The Collection to be checked for the presence of the Collection.valueToFind
- The value to be checked for its presence in the array.- Returns:
true
if the array contains the specified value,false
ifvalueToFind
is not found or c isnull
or empty.
-
contains
Checks if the specifiedIterable
contains the specified value.- Parameters:
c
- TheIterable
to be checked for the presence of the value.valueToFind
- The value to be checked for its presence in theIterable
.- Returns:
true
if the array contains the specified value,false
ifvalueToFind
is not found or c isnull
or empty.
-
contains
Checks if the specified Iterator contains the specified value.- Parameters:
valueToFind
- The value to be checked for its presence in the Iterator.c
- TheIterator
to be checked for the presence of the value.- Returns:
true
if the array contains the specified value,false
ifvalueToFind
is not found or c isnull
or empty.
-
containsAll
Checks if the specified Collection contains all the elements in the specifiedvaluesToFind
Collection.- Parameters:
c
- The Collection to be checked for the presence of the elements in valuesToFind.valuesToFind
- The Collection of values to be checked for their presence in the Collection c.- Returns:
true
if the Collection c contains all the elements invaluesToFind
orvaluesToFind
isnull
or empty,false
if any element invaluesToFind
is not found in c or if c isnull
or empty.
-
containsAll
Checks if the specified Collection contains all the elements in the specifiedvaluesToFind
array.- Parameters:
c
- The Collection to be checked for the presence of the elements in valuesToFind.valuesToFind
- The array of values to be checked for their presence in the Collection c.- Returns:
true
if the Collection c contains all the elements invaluesToFind
orvaluesToFind
isnull
or empty,false
if any element invaluesToFind
is not found in c or if c isnull
or empty.
-
containsAll
Checks if the specifiedIterable
contains all the elements in the specifiedvaluesToFind
Collection.- Parameters:
c
- TheIterable
to be checked for the presence of the elements in valuesToFind.valuesToFind
- The Collection of values to be checked for their presence in theIterable
c.- Returns:
true
if theIterable
c contains all the elements invaluesToFind
orvaluesToFind
isnull
or empty,false
if any element invaluesToFind
is not found in c or if c isnull
or empty.
-
containsAll
Checks if the specified Iterator contains all the elements in the specifiedvaluesToFind
Collection.- Parameters:
valuesToFind
- The Collection of values to be checked for their presence in the Iterator c.c
- TheIterator
to be checked for the presence of the elements in valuesToFind.- Returns:
true
if the Iterator iter contains all the elements invaluesToFind
orvaluesToFind
isnull
or empty,false
if any element invaluesToFind
is not found in iter or if iter isnull
or empty.
-
containsAny
Checks if the specified Collection contains any elements from the specifiedvaluesToFind
Collection.- Parameters:
c
- The Collection to be checked for the presence of any elements in valuesToFind.valuesToFind
- The Collection of values to be checked for their presence in the Collection c.- Returns:
true
if the Collection c contains any elements invaluesToFind
orfalse
if c isnull
or empty, or ifvaluesToFind
isnull
or empty .
-
containsAny
Checks if the specified Collection contains any elements from the specifiedvaluesToFind
array.- Parameters:
c
- The Collection to be checked for the presence of any elements in valuesToFind.valuesToFind
- The array of values to be checked for their presence in the Collection c.- Returns:
true
if the Collection c contains any elements invaluesToFind
orfalse
if c isnull
or empty, or ifvaluesToFind
isnull
or empty .
-
containsAny
Checks if the specifiedIterable
contains any elements from the specifiedvaluesToFind
Set.- Parameters:
c
- TheIterable
to be checked for the presence of any elements in valuesToFind.valuesToFind
- The Set of values to be checked for their presence in theIterable
c.- Returns:
true
if theIterable
c contains any elements invaluesToFind
orfalse
if c isnull
or empty, or ifvaluesToFind
isnull
or empty .
-
containsAny
Checks if the specified Iterator contains any elements from the specifiedvaluesToFind
Set.- Parameters:
iter
- TheIterator
to be checked for the presence of any elements in valuesToFind.valuesToFind
- The Set of values to be checked for their presence in the Iterator iter.- Returns:
true
if the Iterator iter contains any elements invaluesToFind
orfalse
if iter isnull
or empty, or ifvaluesToFind
isnull
or empty .
-
slice
public static <T> ImmutableList<T> slice(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input array from the specified start index to the end index.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The input array to be sliced.fromIndex
- The start index for the slice, inclusive.toIndex
- The end index for the slice, exclusive.- Returns:
- An ImmutableList containing the slice of the input array.
- Throws:
IndexOutOfBoundsException
- if the fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
slice
public static <T> ImmutableList<T> slice(List<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input list from the specified start index to the end index.- Type Parameters:
T
- The type of the elements in the list.- Parameters:
c
- The input list to be sliced.fromIndex
- The start index for the slice, inclusive.toIndex
- The end index for the slice, exclusive.- Returns:
- An ImmutableList containing the slice of the input list.
- Throws:
IndexOutOfBoundsException
- if the fromIndex is negative, toIndex is larger than the length of the list, or fromIndex is larger than toIndex.
-
slice
public static <T> ImmutableCollection<T> slice(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input collection from the specified start index to the end index.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The input collection to be sliced.fromIndex
- The start index for the slice, inclusive.toIndex
- The end index for the slice, exclusive.- Returns:
- An ImmutableCollection containing the slice of the input collection.
- Throws:
IndexOutOfBoundsException
- if the fromIndex is negative, toIndex is larger than the size of the collection, or fromIndex is larger than toIndex.
-
slice
Returns a read-only slice of the input iterator from the specified start index to the end index.- Type Parameters:
T
- The type of the elements in the iterator.- Parameters:
iter
- The input iterator to be sliced.fromIndex
- The start index for the slice, inclusive.toIndex
- The end index for the slice, exclusive.- Returns:
- An ObjIterator containing the slice of the input iterator.
- Throws:
IndexOutOfBoundsException
- if the fromIndex is negative, or fromIndex is larger than toIndex.
-
split
Splits the input boolean array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input boolean array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of boolean sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<boolean[]> split(boolean[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input boolean array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input boolean array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of boolean sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input char array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input char array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of char sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<char[]> split(char[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input char array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input char array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of char sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input byte array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input byte array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of byte sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<byte[]> split(byte[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input byte array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input byte array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of byte sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input short array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input short array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of short sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<short[]> split(short[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input short array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input short array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of short sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input int array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input int array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of int sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<int[]> split(int[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input int array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input int array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of int sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input long array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input long array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of long sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<long[]> split(long[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input long array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input long array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of long sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input float array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input float array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of float sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<float[]> split(float[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input float array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input float array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of float sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input double array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a
- The input double array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of double sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static List<double[]> split(double[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input double array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input double array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of double sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
Splits the input array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The input array to be split.chunkSize
- The desired size of each sub-array.- Returns:
- A list of sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static <T> List<T[]> split(T[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a
- The input array to be split.fromIndex
- The start index for the slice of the array to be split, inclusive.toIndex
- The end index for the slice of the array to be split, exclusive.chunkSize
- The desired size of each sub-array.- Returns:
- A list of sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
split
public static <T> List<List<T>> split(Collection<? extends T> c, int chunkSize) throws IllegalArgumentException Splits the input collection into sub-collections of the specified size. The last sub-collection may be smaller if the total collection size is not a multiple of chunkSize.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The input collection to be split.chunkSize
- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static <T> List<List<T>> split(Collection<? extends T> c, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input collection into sub-collections of the specified size. The last sub-collection may be smaller if the length of specified range is not a multiple of chunkSize. The sub-collections are created from the specified range in the input collection.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The input collection to be split.fromIndex
- The start index for the slice of the collection to be split, inclusive.toIndex
- The end index for the slice of the collection to be split, exclusive.chunkSize
- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.IndexOutOfBoundsException
- if fromIndex is negative, toIndex is larger than the size of the collection, or fromIndex is larger than toIndex.
-
split
public static <T> List<List<T>> split(Iterable<? extends T> c, int chunkSize) throws IllegalArgumentException Splits the inputiterable
into sub-collections of the specified size. The last sub-collection may be smaller if the total iterable size is not a multiple of chunkSize.- Type Parameters:
T
- The type of the elements in theiterable
.- Parameters:
c
- The inputiterable
to be split.chunkSize
- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
public static <T> ObjIterator<List<T>> split(Iterator<? extends T> iter, int chunkSize) throws IllegalArgumentException Splits the input iterator into sub-collections of the specified size. The last sub-collection may be smaller if the total iterator size is not a multiple of chunkSize.- Type Parameters:
T
- The type of the elements in the iterator.- Parameters:
iter
- The input iterator to be split.chunkSize
- The desired size of each sub-collection.- Returns:
- An iterator of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException
- if chunkSize is not a positive integer.
-
split
Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnull
or empty.- Parameters:
str
-chunkSize
- the desired size of each sub String (the last may be smaller).- Returns:
- Throws:
IllegalArgumentException
-
split
public static List<String> split(CharSequence str, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnull
or empty.- Parameters:
str
-fromIndex
-toIndex
-chunkSize
- the desired size of each sub String (the last may be smaller).- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
splitByChunkCount
public static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.
The size of the chunks is larger first.
The size of returned List may be less than the specifiedmaxChunkCount
if the inputtotalSize
is less thanmaxChunkCount
.- Type Parameters:
T
- the type of the elements in the resulting stream- Parameters:
totalSize
- the total size to be split. It could be the size of an array, list, etc.maxChunkCount
- the maximum number of chunks to split intomapper
- a function to map the chunk from and to index to an element in the resulting stream- Returns:
- a Stream of the mapped chunk values
- Throws:
IllegalArgumentException
- iftotalSize
is negative ormaxChunkCount
is not positive.- See Also:
-
splitByChunkCount
public static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, boolean sizeSmallerFirst, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.
The size of the chunks can be either smaller or larger first based on the flag.
The size of returned List may be less than the specifiedmaxChunkCount
if the inputtotalSize
is less thanmaxChunkCount
.final int[] a = Array.rangeClosed(1, 7); splitByChunkCount(7, 5, true, (fromIndex, toIndex) -> copyOfRange(a, fromIndex, toIndex)); // [[1], [2], [3], [4, 5], [6, 7]] splitByChunkCount(7, 5, false, (fromIndex, toIndex) -> copyOfRange(a, fromIndex, toIndex)); // [[1, 2], [3, 4], [5], [6], [7]]
- Type Parameters:
T
- the type of the elements in the resulting stream- Parameters:
totalSize
- the total size to be split. It could be the size of an array, list, etc.maxChunkCount
- the maximum number of chunks to split intosizeSmallerFirst
- iftrue
, smaller chunks will be created first; otherwise, larger chunks will be created firstmapper
- a function to map the chunk from and to index to an element in the resulting stream- Returns:
- a Stream of the mapped chunk values
- Throws:
IllegalArgumentException
- iftotalSize
is negative ormaxChunkCount
is not positive.- See Also:
-
splitByChunkCount
Splits the input collection into sub-lists based on the specified maximum chunk count.
The size of the chunks is larger first.
The size of returned List may be less than the specifiedmaxChunkCount
if the input Collection size is less thanmaxChunkCount
.- Type Parameters:
T
- the type of elements in the collection- Parameters:
c
- the input collection to be splitmaxChunkCount
- the maximum number of chunks to split into- Returns:
- a list of sub-lists.
- Throws:
IllegalArgumentException
- ifmaxChunkCount
is not positive.- See Also:
-
splitByChunkCount
public static <T> List<List<T>> splitByChunkCount(Collection<? extends T> c, int maxChunkCount, boolean sizeSmallerFirst) Splits the input collection into sub-lists based on the specified maximum chunk count.
The size of the chunks can be either smaller or larger first based on the flag.
The size of returned List may be less than the specifiedmaxChunkCount
if the input Collection size is less thanmaxChunkCount
.final List
c = N.asList(1, 2, 3, 4, 5, 6, 7); splitByChunkCount(c, 5, true); // [[1], [2], [3], [4, 5], [6, 7]] splitByChunkCount(c, 5, false); // [[1, 2], [3, 4], [5], [6], [7]] - Type Parameters:
T
- the type of elements in the collection- Parameters:
c
- the input collection to be splitmaxChunkCount
- the maximum number of chunks to split intosizeSmallerFirst
- iftrue
, smaller chunks will be created first; otherwise, larger chunks will be created first- Returns:
- a list of sub-lists.
- Throws:
IllegalArgumentException
- ifmaxChunkCount
is not positive.- See Also:
-
concat
public static boolean[] concat(boolean[] a, boolean[] b) Concatenates two boolean arrays into a new array.- Parameters:
a
- The first boolean array.b
- The second boolean array.- Returns:
- A new boolean array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple boolean arrays into a new array.- Parameters:
aa
- The boolean arrays to be concatenated.- Returns:
- A new boolean array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static char[] concat(char[] a, char[] b) Concatenates two char arrays into a new array.- Parameters:
a
- The first char array.b
- The second char array.- Returns:
- A new char array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple char arrays into a new array.- Parameters:
aa
- The char arrays to be concatenated.- Returns:
- A new char array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static byte[] concat(byte[] a, byte[] b) Concatenates two byte arrays into a new array.- Parameters:
a
- The first byte array.b
- The second byte array.- Returns:
- A new byte array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple byte arrays into a new array.- Parameters:
aa
- The byte arrays to be concatenated.- Returns:
- A new byte array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static short[] concat(short[] a, short[] b) Concatenates two short arrays into a new array.- Parameters:
a
- The first short array.b
- The second short array.- Returns:
- A new short array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple short arrays into a new array.- Parameters:
aa
- The short arrays to be concatenated.- Returns:
- A new short array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static int[] concat(int[] a, int[] b) Concatenates two int arrays into a new array.- Parameters:
a
- The first int array.b
- The second int array.- Returns:
- A new int array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple int arrays into a new array.- Parameters:
aa
- The int arrays to be concatenated.- Returns:
- A new int array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static long[] concat(long[] a, long[] b) Concatenates two long arrays into a new array.- Parameters:
a
- The first long array.b
- The second long array.- Returns:
- A new long array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple long arrays into a new array.- Parameters:
aa
- The long arrays to be concatenated.- Returns:
- A new long array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static float[] concat(float[] a, float[] b) Concatenates two float arrays into a new array.- Parameters:
a
- The first float array.b
- The second float array.- Returns:
- A new float array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple float arrays into a new array.- Parameters:
aa
- The float arrays to be concatenated.- Returns:
- A new float array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static double[] concat(double[] a, double[] b) Concatenates two double arrays into a new array.- Parameters:
a
- The first double array.b
- The second double array.- Returns:
- A new double array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty array is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple double arrays into a new array.- Parameters:
aa
- The double arrays to be concatenated.- Returns:
- A new double array that contains the elements of each array in
'aa'
in the same order. If'aa'
is empty ornull
, an empty array is returned. If'aa'
contains only one array, a clone of this array is returned.
-
concat
public static <T> T[] concat(T[] a, T[] b) Concatenates two arrays into a new array.- Type Parameters:
T
- The type of the elements in the arrays.- Parameters:
a
- The first array.b
- The second array.- Returns:
- A new array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, a is returned. If a is empty ornull
, a clone of b is returned. If b is empty ornull
, a clone of a is returned.
-
concat
Concatenates multiple arrays into a new array.- Type Parameters:
T
- The type of the elements in the arrays.- Parameters:
aa
- The arrays to be concatenated.- Returns:
- A new array that contains the elements of each array in
'aa'
in the same order. If all of the specified arrays arenull
,null
is returned. - See Also:
-
concat
Concatenates two iterables into a new list.- Type Parameters:
T
- The type of the elements in theiterables
.- Parameters:
a
- The first iterable.b
- The second iterable.- Returns:
- A new list that contains the elements of a followed by the elements of b.
If both a and b are empty or
null
, an empty list is returned. If a is empty ornull
, a list containing the elements of b is returned. If b is empty ornull
, a list containing the elements of a is returned.
-
concat
Concatenates multiple iterables into a new list.- Type Parameters:
T
- The type of the elements in theiterables
.- Parameters:
a
- The iterables to be concatenated.- Returns:
- A new list that contains the elements of each iterable in a in the same order.
If a is empty or
null
, an empty list is returned. If a contains only one iterable, a list containing the elements of this iterable is returned.
-
concat
Concatenates multiple iterables into a new list.- Type Parameters:
T
- The type of the elements in theiterables
.- Parameters:
c
- The collection of iterables to be concatenated.- Returns:
- A new list that contains the elements of each iterable in c in the same order.
If c is empty or
null
, an empty list is returned. If c contains only one iterable, a list containing the elements of this iterable is returned.
-
concat
public static <T,C extends Collection<T>> C concat(Collection<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Concatenates multiple iterables into a new collection.- Type Parameters:
T
- The type of the elements in theiterables
.C
- The type of the collection to be returned.- Parameters:
c
- The collection of iterables to be concatenated.supplier
- The function that generates a new instance of the return collection.- Returns:
- A new collection that contains the elements of each iterable in c in the same order.
The type of the returned collection is determined by the supplier function.
If c is empty or
null
, an empty collection is returned. If c contains only one iterable, a collection containing the elements of this iterable is returned.
-
concat
Concatenates two iterators into a new ObjIterator.- Type Parameters:
T
- The type of the elements in the iterators.- Parameters:
a
- The first iterator.b
- The second iterator.- Returns:
- A new ObjIterator that contains the elements of a followed by the elements of b.
- See Also:
-
concat
Concatenates multiple iterators into a new ObjIterator.- Type Parameters:
T
- The type of the elements in the iterators.- Parameters:
a
- The array of iterators to be concatenated.- Returns:
- A new ObjIterator that contains the elements of each iterator in a in the same order.
- See Also:
-
flatten
public static boolean[] flatten(boolean[][] a) Flattens a two-dimensional boolean array into a one-dimensional boolean array.- Parameters:
a
- The two-dimensional boolean array to be flattened.- Returns:
- A one-dimensional boolean array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static char[] flatten(char[][] a) Flattens a two-dimensional char array into a one-dimensional char array.- Parameters:
a
- The two-dimensional char array to be flattened.- Returns:
- A one-dimensional char array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static byte[] flatten(byte[][] a) Flattens a two-dimensional byte array into a one-dimensional byte array.- Parameters:
a
- The two-dimensional byte array to be flattened.- Returns:
- A one-dimensional byte array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static short[] flatten(short[][] a) Flattens a two-dimensional short array into a one-dimensional short array.- Parameters:
a
- The two-dimensional short array to be flattened.- Returns:
- A one-dimensional short array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static int[] flatten(int[][] a) Flattens a two-dimensional int array into a one-dimensional int array.- Parameters:
a
- The two-dimensional int array to be flattened.- Returns:
- A one-dimensional int array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static long[] flatten(long[][] a) Flattens a two-dimensional long array into a one-dimensional long array.- Parameters:
a
- The two-dimensional long array to be flattened.- Returns:
- A one-dimensional long array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static float[] flatten(float[][] a) Flattens a two-dimensional float array into a one-dimensional float array.- Parameters:
a
- The two-dimensional float array to be flattened.- Returns:
- A one-dimensional float array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
public static double[] flatten(double[][] a) Flattens a two-dimensional double array into a one-dimensional double array.- Parameters:
a
- The two-dimensional double array to be flattened.- Returns:
- A one-dimensional double array containing all elements in the input array.
Returns an empty array if the input array is
null
or empty.
-
flatten
Flattens a two-dimensional array into a one-dimensional array.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The two-dimensional array to be flattened.- Returns:
- A one-dimensional array containing all elements in the input array. Returns
null
if the input array isnull
.
-
flatten
Flattens a two-dimensional array into a one-dimensional array.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The two-dimensional array to be flattened.componentType
- The class object representing the component type of the new array.- Returns:
- A one-dimensional array containing all elements in the input array.
Returns an empty array if the input array is
null
.
-
flatten
Flattens anIterable
ofIterable<T>
into a one-dimensional List.- Type Parameters:
T
- The type of the elements in theIterable
.- Parameters:
c
- The two-dimensionalIterable
to be flattened.- Returns:
- A one-dimensional List containing all elements in the input
Iterable
. Returns an empty List if the inputIterable
isnull
or empty.
-
flatten
public static <T,C extends Collection<T>> C flatten(Iterable<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Flattens anIterable
ofIterable<T>
into a one-dimensional Collection.- Type Parameters:
T
- The type of the elements in theIterable
.C
- The type of the Collection to be returned.- Parameters:
c
- The two-dimensionalIterable
to be flattened.supplier
- The function that generates the Collection instance.- Returns:
- A one-dimensional Collection containing all elements in the input
Iterable
. Returns an empty Collection if the inputIterable
isnull
or empty.
-
flatten
Flattens anIterator
ofIterator<T>
into a one-dimensional Iterator.- Type Parameters:
T
- The type of the elements in the Iterator.- Parameters:
iters
- The two-dimensional Iterator to be flattened.- Returns:
- A one-dimensional Iterator containing all elements in the input
Iterator
. Returns an empty Iterator if the inputIterator
isnull
.
-
flattenEachElement
Flattens each element of the providedIterable
if it's anIterable
itself, otherwise just adds it to the result List. This method is marked as Beta and may be subject to changes or removal in future versions.- Parameters:
c
- TheIterable
to be processed. Each element is checked if it's anIterable
and flattened if so.- Returns:
- A List containing the flattened elements of the input
Iterable
. If the inputIterable
isnull
, an empty List is returned.
-
flattenEachElement
@Beta public static <T,C extends Collection<T>> C flattenEachElement(Iterable<?> c, Supplier<? extends C> supplier) Flattens each element of the providedIterable
if it's anIterable
itself, otherwise just adds it to the result Collection. This method is marked as Beta and may be subject to changes or removal in future versions.- Type Parameters:
T
- The type of the elements in theIterable
.C
- The type of the Collection to be returned.- Parameters:
c
- TheIterable
to be processed. Each element is checked if it's anIterable
and flattened if so.supplier
- The function that generates the Collection instance.- Returns:
- A Collection containing the flattened elements of the input
Iterable
. If the inputIterable
isnull
, an empty Collection is returned.
-
intersection
public static boolean[] intersection(boolean[] a, boolean[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static char[] intersection(char[] a, char[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static byte[] intersection(byte[] a, byte[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static short[] intersection(short[] a, short[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static int[] intersection(int[] a, int[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = retainAll(a, b); // The elements c in a will b: [1, 2, 2]. int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = intersection(a, b); // The elements c in a will b: [1, 2].
- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static long[] intersection(long[] a, long[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static float[] intersection(float[] a, float[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
public static double[] intersection(double[] a, double[] b) Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
Returns the elements in the specified Array/Collection a and b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
intersection
Returns the elements in all the specified collections. Occurrences are considered.- Type Parameters:
T
- the type of elements in the collections- Parameters:
c
- the collections to intersect- Returns:
- a list containing the intersection of the collections
- See Also:
-
intersection
@Beta public static <T> List<T> intersection(Collection<? extends T> a, Collection<?> b, boolean ignoreOcurrences) Return only the elements in the first collection that are contained in the specified second collection.
IfignoreOcurrences
istrue
, Occurrences are not considered.
Duplicated elements in the returned List will not be eliminated.List
a = N.asList(0, 1, 2, 2, 3); List b = N.asList(2, 5, 1); List c = N.intersection(a, b, false); // The elements c in a will b: [1, 2]. same as N.intersection(a, b). List d = N.intersection(a, b, true); // The elements c in a will b: [1, 2, 2]. - Type Parameters:
T
- the type of elements in the collections- Parameters:
a
- the first collection, elements from this collection will be retainedb
- the second collection, elements in this collection are to be retained in the first collectionignoreOcurrences
- iftrue
, the method does not consider the number of occurrences of an element.- Returns:
- a List the elements in the first collection that are contained in the specified second collection.
- See Also:
-
difference
public static boolean[] difference(boolean[] a, boolean[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static char[] difference(char[] a, char[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static byte[] difference(byte[] a, byte[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static short[] difference(short[] a, short[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static int[] difference(int[] a, int[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = removeAll(a, b); // The elements c in a will b: [0, 3]. int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = difference(a, b); // The elements c in a will b: [0, 2, 3].
- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static long[] difference(long[] a, long[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static float[] difference(float[] a, float[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
public static double[] difference(double[] a, double[] b) Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- See Also:
-
difference
Returns all the elements in the specified Array/Collection a but not in b. Occurrences are considered.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static boolean[] symmetricDifference(boolean[] a, boolean[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static char[] symmetricDifference(char[] a, char[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static byte[] symmetricDifference(byte[] a, byte[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static short[] symmetricDifference(short[] a, short[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static int[] symmetricDifference(int[] a, int[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are consideredint[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = symmetricDifference(a, b); // The elements c in a will b: [0, 2, 3, 5].
- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static long[] symmetricDifference(long[] a, long[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static float[] symmetricDifference(float[] a, float[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
public static double[] symmetricDifference(double[] a, double[] b) Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- See Also:
-
symmetricDifference
Returns the elements that are in the specified Array/Collection a but not in b and vice versa. Occurrences are considered- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- See Also:
-
commonSet
Returns a Set containing the common elements of two given collections.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- See Also:
-
commonSet
Returns a Set containing the common elements of the given collections.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
exclude
Returns a newList
with specified objToExclude excluded. That's to say no more objToExclude will present in the returnedList
.- Type Parameters:
T
-- Parameters:
c
-objToExclude
-- Returns:
- a new
List
- See Also:
-
excludeToSet
Returns a newSet
with specified objToExclude excluded. That's to say no more objToExclude will present in the returnedSet
.- Type Parameters:
T
-- Parameters:
c
-objToExclude
-- Returns:
- a new
Set
- See Also:
-
excludeAll
Returns a newList
with specified objsToExclude excluded. That's to say no more value from objsToExclude will present in the returnedList
.- Type Parameters:
T
-- Parameters:
c
-objsToExclude
-- Returns:
- a new
List
- See Also:
-
excludeAllToSet
Returns a newSet
with specified objsToExclude excluded. That's to say no more value from objsToExclude will present in the returnedSet
.- Type Parameters:
T
-- Parameters:
c
-objsToExclude
-- Returns:
- a new
Set
- See Also:
-
isSubCollection
public static boolean isSubCollection(@NotNull Collection<?> subColl, @NotNull Collection<?> coll) throws IllegalArgumentException Returnstrue
if subColl is a sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl.- Parameters:
subColl
- the first (sub?) collection, must not be nullcoll
- the second (super?) collection, must not be null- Returns:
true
if subColl is a sub-collection of coll- Throws:
IllegalArgumentException
- ifsubColl
orcoll
isnull
- See Also:
-
isProperSubCollection
public static boolean isProperSubCollection(@NotNull Collection<?> subColl, @NotNull Collection<?> coll) throws IllegalArgumentException Returnstrue
if subColl is a proper sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl, and there is at least one element f such that the cardinality of f in coll is strictly greater than the cardinality of f in subColl.The implementation assumes
subColl.size()
andcoll.size()
represent the total cardinality of a and b, resp.subColl.size() < Integer.MAXVALUE
- Parameters:
subColl
- the first (sub?) collection, must not be nullcoll
- the second (super?) collection, must not be null- Returns:
true
if subColl is a proper sub-collection of coll- Throws:
IllegalArgumentException
- ifsubColl
orcoll
isnull
- See Also:
-
isEqualCollection
Returnstrue
if the givenCollection
s contain exactly the same elements with exactly the same cardinalities.That is, if the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b.
- Parameters:
a
- the first collectionb
- the second collection- Returns:
true
if the collections contain the same elements with the same cardinalities.
-
replaceAll
public static int replaceAll(boolean[] a, boolean oldVal, boolean newVal) Replaces all occurrences of a specified boolean value in the given boolean array with another specified boolean value.- Parameters:
a
- The boolean array in which replacements are to be made.oldVal
- The boolean value to be replaced.newVal
- The boolean value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(char[] a, char oldVal, char newVal) Replaces all occurrences of a specified char value in the given char array with another specified char value.- Parameters:
a
- The char array in which replacements are to be made.oldVal
- The char value to be replaced.newVal
- The char value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(byte[] a, byte oldVal, byte newVal) Replaces all occurrences of a specified byte value in the given byte array with another specified byte value.- Parameters:
a
- The byte array in which replacements are to be made.oldVal
- The byte value to be replaced.newVal
- The byte value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(short[] a, short oldVal, short newVal) Replaces all occurrences of a specified short value in the given short array with another specified short value.- Parameters:
a
- The short array in which replacements are to be made.oldVal
- The short value to be replaced.newVal
- The short value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(int[] a, int oldVal, int newVal) Replaces all occurrences of a specified int value in the given int array with another specified int value.- Parameters:
a
- The int array in which replacements are to be made.oldVal
- The int value to be replaced.newVal
- The int value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(long[] a, long oldVal, long newVal) Replaces all occurrences of a specified long value in the given long array with another specified long value.- Parameters:
a
- The long array in which replacements are to be made.oldVal
- The long value to be replaced.newVal
- The long value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(float[] a, float oldVal, float newVal) Replaces all occurrences of a specified float value in the given float array with another specified float value.- Parameters:
a
- The float array in which replacements are to be made.oldVal
- The float value to be replaced.newVal
- The float value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
public static int replaceAll(double[] a, double oldVal, double newVal) Replaces all occurrences of a specified double value in the given double array with another specified double value.- Parameters:
a
- The double array in which replacements are to be made.oldVal
- The double value to be replaced.newVal
- The double value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
Replaces all occurrences of a specified value in the given array with another specified value.- Type Parameters:
T
- The type of elements in the array.- Parameters:
a
- The array in which replacements are to be made.oldVal
- The value to be replaced.newVal
- The value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
Replaces all occurrences of a specified value in the given list with another specified value.- Type Parameters:
T
- The type of elements in the list.- Parameters:
list
- The list in which replacements are to be made.oldVal
- The value to be replaced.newVal
- The value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made.
-
replaceAll
Replaces all elements in the given boolean array according to the provided unary operator.- Parameters:
a
- The boolean array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given char array according to the provided unary operator.- Parameters:
a
- The char array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given byte array according to the provided unary operator.- Parameters:
a
- The byte array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given short array according to the provided unary operator.- Parameters:
a
- The short array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given int array according to the provided unary operator.- Parameters:
a
- The int array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given long array according to the provided unary operator.- Parameters:
a
- The long array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given float array according to the provided unary operator.- Parameters:
a
- The float array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given double array according to the provided unary operator.- Parameters:
a
- The double array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given array according to the provided unary operator.- Type Parameters:
T
- The type of elements in the array.- Parameters:
a
- The array to be modified.operator
- The operator used to determine the new values.
-
replaceAll
Replaces all elements in the given list according to the provided unary operator.- Type Parameters:
T
- The type of elements in the list.- Parameters:
list
- The list to be modified.operator
- The operator used to determine the new values.
-
replaceIf
Replaces all elements in the given boolean array that satisfy the provided predicate with a specified boolean value.- Parameters:
a
- The boolean array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The boolean value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given char array that satisfy the provided predicate with a specified char value.- Parameters:
a
- The char array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The char value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given byte array that satisfy the provided predicate with a specified byte value.- Parameters:
a
- The byte array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The byte value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given short array that satisfy the provided predicate with a specified short value.- Parameters:
a
- The short array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The short value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given int array that satisfy the provided predicate with a specified int value.- Parameters:
a
- The int array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The int value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given long array that satisfy the provided predicate with a specified long value.- Parameters:
a
- The long array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The long value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given float array that satisfy the provided predicate with a specified float value.- Parameters:
a
- The float array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The float value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given double array that satisfy the provided predicate with a specified double value.- Parameters:
a
- The double array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The double value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given array that satisfy the provided predicate with a specified value.- Type Parameters:
T
- The type of elements in the array.- Parameters:
a
- The array to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
replaceIf
Replaces all elements in the given list that satisfy the provided predicate with a specified value.- Type Parameters:
T
- The type of elements in the list.- Parameters:
c
- The list to be modified.predicate
- The predicate used to determine which elements should be replaced.newValue
- The value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made.
-
updateAllUsingReplaceAllInstead
@Deprecated public static void updateAllUsingReplaceAllInstead() throws UnsupportedOperationExceptionDeprecated.usereplaceAll
A fake/unsupported method defined to remind user to usereplaceAll
whenupdate/updateAll/updateIf
is searched.- Throws:
UnsupportedOperationException
- See Also:
-
updateIfUsingReplaceIfInstead
Deprecated.usereplaceIf
A fake/unsupported method defined to remind user to usereplaceIf
whenupdate/updateAll/updateIf
is searched.- Throws:
UnsupportedOperationException
- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnull
or empty, does nothing.- Type Parameters:
T
- the type of elements in the array- Parameters:
array
- the array to be modifiedgenerator
- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given list using the provided generator function. If the specified list isnull
or empty, does nothing.- Type Parameters:
T
- the type of elements in the list- Parameters:
list
- the list to be modifiedgenerator
- the function used to generate new values for the list elements
-
add
public static boolean[] add(boolean[] a, boolean elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original boolean array.elementToAdd
- The boolean element to be added to the array.- Returns:
- A new boolean array containing the original elements and the added element.
-
add
public static char[] add(char[] a, char elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original char array.elementToAdd
- The char element to be added to the array.- Returns:
- A new char array containing the original elements and the added element.
-
add
public static byte[] add(byte[] a, byte elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original byte array.elementToAdd
- The byte element to be added to the array.- Returns:
- A new byte array containing the original elements and the added element.
-
add
public static short[] add(short[] a, short elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original short array.elementToAdd
- The short element to be added to the array.- Returns:
- A new short array containing the original elements and the added element.
-
add
public static int[] add(int[] a, int elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original int array.elementToAdd
- The int element to be added to the array.- Returns:
- A new int array containing the original elements and the added element.
-
add
public static long[] add(long[] a, long elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original long array.elementToAdd
- The long element to be added to the array.- Returns:
- A new long array containing the original elements and the added element.
-
add
public static float[] add(float[] a, float elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original float array.elementToAdd
- The float element to be added to the array.- Returns:
- A new float array containing the original elements and the added element.
-
add
public static double[] add(double[] a, double elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original double array.elementToAdd
- The double element to be added to the array.- Returns:
- A new double array containing the original elements and the added element.
-
add
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The original String array.elementToAdd
- The String element to be added to the array.- Returns:
- A new String array containing the original elements and the added element.
-
add
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Type Parameters:
T
- The type of elements in the array.- Parameters:
a
- The original array.elementToAdd
- The element to be added to the array.- Returns:
- A new array containing the original elements and the added element.
- Throws:
IllegalArgumentException
- if the original array isnull
.
-
addAll
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new boolean array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new char array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new byte array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new short array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new int array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new long array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new float array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new double array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a
- The first array whose elements are added to the new array.elementsToAdd
- The additional elements to be added to the new array.- Returns:
- A new String array containing the elements from a and elementsToAdd.
-
addAll
@SafeVarargs public static <T> T[] addAll(@NotNull T[] a, T... elementsToAdd) throws IllegalArgumentException Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Type Parameters:
T
- The type of elements in the array.- Parameters:
a
- The original array.elementsToAdd
- The elements to be added to the array.- Returns:
- A new array containing the original elements and the added elements.
- Throws:
IllegalArgumentException
- if the input array a and elementsToAdd both arenull
.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, T... elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to a given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The original collection.elementsToAdd
- The elements to be added to the collection.- Returns:
- A boolean indicating if the collection changed as a result of the call.
- Throws:
IllegalArgumentException
- if the original collection isnull
.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, Iterable<? extends T> elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to a given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The original collection where elements are to be added.elementsToAdd
- The collection of elements to be added to the original collection.- Returns:
- A boolean indicating if the original collection changed as a result of the call.
- Throws:
IllegalArgumentException
- if the original collection isnull
.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, Iterator<? extends T> elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to a given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The original collection where elements are to be added.elementsToAdd
- The iterator of elements to be added to the original collection.- Returns:
- A boolean indicating if the original collection changed as a result of the call.
- Throws:
IllegalArgumentException
- if the original collection isnull
.
-
insert
public static boolean[] insert(boolean[] a, int index, boolean elementToInsert) throws IndexOutOfBoundsException Inserts a boolean value into a given boolean array at a specified index. The method creates a new array, copies the original array into it, then adds the new element at the specified index. The original array remains unchanged.- Parameters:
a
- the original boolean arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the char value to be inserted into the array- Returns:
- a new char array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static char[] insert(char[] a, int index, char elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original char arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the boolean value to be inserted into the array- Returns:
- a new boolean array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static byte[] insert(byte[] a, int index, byte elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original byte arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the byte value to be inserted into the array- Returns:
- a new byte array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static short[] insert(short[] a, int index, short elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original short arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the short value to be inserted into the array- Returns:
- a new short array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static int[] insert(int[] a, int index, int elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original int arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the int value to be inserted into the array- Returns:
- a new int array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static long[] insert(long[] a, int index, long elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original long arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the long value to be inserted into the array- Returns:
- a new long array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static float[] insert(float[] a, int index, float elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original float arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the float value to be inserted into the array- Returns:
- a new float array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static double[] insert(double[] a, int index, double elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original double arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the double value to be inserted into the array- Returns:
- a new double array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static String[] insert(String[] a, int index, String elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original String arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the String value to be inserted into the array- Returns:
- a new String array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static <T> T[] insert(@NotNull T[] a, int index, T elementToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Type Parameters:
T
- the type of the elements in the array- Parameters:
a
- the original arrayindex
- the position in the array where the new element should be insertedelementToInsert
- the element to be inserted into the array- Returns:
- a new array with the original elements and the inserted element
- Throws:
IllegalArgumentException
- if the original array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static String insert(String str, int index, String strToInsert) throws IndexOutOfBoundsException Returns a new String with chars copied from the specified String and the specified String inserted at the specified index.
The original String remains unchanged.- Parameters:
str
- the original stringindex
- the position in the string where the new string should be insertedstrToInsert
- the string to be inserted into the original string- Returns:
- a new string with the original characters and the inserted string
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > str.length())
-
insertAll
@SafeVarargs public static boolean[] insertAll(boolean[] a, int index, boolean... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static char[] insertAll(char[] a, int index, char... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static byte[] insertAll(byte[] a, int index, byte... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static short[] insertAll(short[] a, int index, short... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static int[] insertAll(int[] a, int index, int... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static long[] insertAll(long[] a, int index, long... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static float[] insertAll(float[] a, int index, float... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static double[] insertAll(double[] a, int index, double... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static String[] insertAll(String[] a, int index, String... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static <T> T[] insertAll(@NotNull T[] a, int index, T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position in the array where the new elements should be insertedelementsToInsert
- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IllegalArgumentException
- if the specifiedArray
isnull
.IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static <T> boolean insertAll(@NotNull List<T> list, int index, T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Inserts the specified elements at the specified position in the list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Type Parameters:
T
- the type of elements in the list- Parameters:
list
- the list to insert intoindex
- the position in the list where the new elements should be insertedelementsToInsert
- the elements to be inserted into the list- Returns:
true
if the list changed as a result of the call- Throws:
IllegalArgumentException
- if the list isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > list.size())
-
insertAll
public static <T> boolean insertAll(@NotNull List<T> list, int index, Collection<? extends T> elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Inserts the specified elements at the specified position in the list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Type Parameters:
T
- the type of elements in the list- Parameters:
list
- the list to insert intoindex
- the position in the list where the new elements should be insertedelementsToInsert
- the elements to be inserted into the list- Returns:
true
if the list changed as a result of the call- Throws:
IllegalArgumentException
- if the list isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index > list.size())
-
deleteByIndex
public static boolean[] deleteByIndex(@NotNull boolean[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original boolean arrayindex
- the position of the element to be removed- Returns:
- a new boolean array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static char[] deleteByIndex(@NotNull char[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original char arrayindex
- the position of the element to be removed- Returns:
- a new char array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static byte[] deleteByIndex(@NotNull byte[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original byte arrayindex
- the position of the element to be removed- Returns:
- a new byte array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static short[] deleteByIndex(@NotNull short[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original short arrayindex
- the position of the element to be removed- Returns:
- a new short array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static int[] deleteByIndex(@NotNull int[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original int arrayindex
- the position of the element to be removed- Returns:
- a new int array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static long[] deleteByIndex(@NotNull long[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original long arrayindex
- the position of the element to be removed- Returns:
- a new long array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static float[] deleteByIndex(@NotNull float[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original float arrayindex
- the position of the element to be removed- Returns:
- a new float array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static double[] deleteByIndex(@NotNull double[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original double arrayindex
- the position of the element to be removed- Returns:
- a new double array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteByIndex
public static <T> T[] deleteByIndex(@NotNull T[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a
- the original arrayindex
- the position of the element to be removed- Returns:
- a new array containing the existing elements except the element at the specified index
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= a.length)
-
deleteAllByIndices
@SafeVarargs public static boolean[] deleteAllByIndices(boolean[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input boolean array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new boolean array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static char[] deleteAllByIndices(char[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input char array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new char array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static byte[] deleteAllByIndices(byte[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input byte array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new byte array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static short[] deleteAllByIndices(short[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input short array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new short array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static int[] deleteAllByIndices(int[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input int array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new int array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static long[] deleteAllByIndices(long[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input long array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new long array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static float[] deleteAllByIndices(float[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input float array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new float array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static double[] deleteAllByIndices(double[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input double array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new double array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static String[] deleteAllByIndices(String[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Parameters:
a
- the input String array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new String array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static <T> T[] deleteAllByIndices(@NotNull T[] a, int... indices) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified positions.
The original array remains unchanged.- Type Parameters:
T
- the type of elements in the array- Parameters:
a
- the input array from which elements are to be removedindices
- the indices of the elements to be removed- Returns:
- a new array containing the remaining elements after removal
- Throws:
IllegalArgumentException
- if the input array isnull
IndexOutOfBoundsException
- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static boolean deleteAllByIndices(@NotNull List<?> list, int... indices) throws IllegalArgumentException Removes the elements at the specified positions from the specified List.- Parameters:
list
-indices
-- Returns:
- Throws:
IllegalArgumentException
-
remove
public static boolean[] remove(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static char[] remove(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static byte[] remove(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static short[] remove(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static int[] remove(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static long[] remove(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static float[] remove(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
public static double[] remove(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
remove
Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. The input array itself is returned if the specified array is
null
or empty. - Throws:
IllegalArgumentException
-
remove
Removes the first occurrence of the specified value from the given collection.- Parameters:
c
- The collection from which the value should be removed.valueToRemove
- The value to be removed from the collection.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a
- The array from which the values should be removed.valuesToRemove
- The values to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. The input array itself is returned if the specified array is
null
or empty. - See Also:
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The collection from which the values should be removed.valuesToRemove
- The values to be removed from the collection.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The collection from which the values should be removed.valuesToRemove
- The collection of values to be removed from the collection.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The collection from which the elements should be removed.valuesToRemove
- The iterator of values to be removed from the collection.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeAllOccurrences
public static boolean[] removeAllOccurrences(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static char[] removeAllOccurrences(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static byte[] removeAllOccurrences(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static short[] removeAllOccurrences(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static int[] removeAllOccurrences(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static long[] removeAllOccurrences(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static float[] removeAllOccurrences(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static double[] removeAllOccurrences(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
null
or empty.
-
removeAllOccurrences
public static <T> T[] removeAllOccurrences(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a
- The array from which the value should be removed.valueToRemove
- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. The input array itself is returned if the specified array is
null
or empty.
-
removeAllOccurrences
Removes all occurrences of the specified value from the given collection.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
c
- The collection from which the value should be removed.valueToRemove
- The value to be removed from the collection.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeDuplicates
public static boolean[] removeDuplicates(boolean[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static boolean[] removeDuplicates(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The boolean array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.- Returns:
- a new array with duplicate elements from the given array within the specified range
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static char[] removeDuplicates(char[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static char[] removeDuplicates(char[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static char[] removeDuplicates(char[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static byte[] removeDuplicates(byte[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static byte[] removeDuplicates(byte[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static byte[] removeDuplicates(byte[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static short[] removeDuplicates(short[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static short[] removeDuplicates(short[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static short[] removeDuplicates(short[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static int[] removeDuplicates(int[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static int[] removeDuplicates(int[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static int[] removeDuplicates(int[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static long[] removeDuplicates(long[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static long[] removeDuplicates(long[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static long[] removeDuplicates(long[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static float[] removeDuplicates(float[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static float[] removeDuplicates(float[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static float[] removeDuplicates(float[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static double[] removeDuplicates(double[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static double[] removeDuplicates(double[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static double[] removeDuplicates(double[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
null
or empty.
-
removeDuplicates
public static String[] removeDuplicates(String[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. The input array itself is returned if the specified array is
null
or empty.
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
- a new array with all duplicates removed. The input array itself is returned if the specified array is
null
or empty.
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with duplicate elements removed within the specified range.
The original array remains unchanged.- Parameters:
a
- The array from which duplicates should be removed.fromIndex
- The initial index of the range to be considered for duplicate removal.toIndex
- The final index of the range to be considered for duplicate removal.isSorted
- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue
, the algorithm will be faster.- Returns:
- A new array with duplicates removed within the specified range.
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds.
-
removeDuplicates
Removes duplicate elements from the given collection.- Parameters:
c
- The collection from which duplicates should be removed.- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
removeDuplicates
Removes duplicate elements from the given collection.- Parameters:
c
- The collection from which duplicates should be removed.isSorted
- A boolean flag indicating whether the input array is sorted. Iftrue
, the algorithm will be faster- Returns:
true
if the collection changed as a result of this call,false
otherwise.
-
deleteRange
public static boolean[] deleteRange(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static char[] deleteRange(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static byte[] deleteRange(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static short[] deleteRange(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static int[] deleteRange(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static long[] deleteRange(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static float[] deleteRange(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static double[] deleteRange(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static String[] deleteRange(String[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the array boundsIllegalArgumentException
-
deleteRange
public static <T> T[] deleteRange(@NotNull T[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a
- the input array from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed
- Throws:
IllegalArgumentException
- if the specified originalArray
isnull
.IndexOutOfBoundsException
- if the range is out of the array bounds
-
deleteRange
public static <T> boolean deleteRange(List<T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Deletes a range of elements from the given list.- Type Parameters:
T
- the type of elements in the list- Parameters:
c
- the input list from which a range of elements are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
true
if the list is updated;false
otherwise- Throws:
IndexOutOfBoundsException
- if the range is out of the list bounds
-
deleteRange
public static String deleteRange(String str, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new String with the specified range of chars removed
The original String remains unchanged.- Parameters:
str
- the input string from which a range of characters are to be deletedfromIndex
- the initial index of the range to be deleted, inclusivetoIndex
- the final index of the range to be deleted, exclusive- Returns:
- a new string with the specified range of characters deleted. An empty String is returned if the specified String is
null
or empty. - Throws:
IndexOutOfBoundsException
- if the range is out of the string bounds- See Also:
-
replaceRange
public static boolean[] replaceRange(boolean[] a, int fromIndex, int toIndex, boolean[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static char[] replaceRange(char[] a, int fromIndex, int toIndex, char[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static byte[] replaceRange(byte[] a, int fromIndex, int toIndex, byte[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static short[] replaceRange(short[] a, int fromIndex, int toIndex, short[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static int[] replaceRange(int[] a, int fromIndex, int toIndex, int[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static long[] replaceRange(long[] a, int fromIndex, int toIndex, long[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static float[] replaceRange(float[] a, int fromIndex, int toIndex, float[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static double[] replaceRange(double[] a, int fromIndex, int toIndex, double[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static String[] replaceRange(String[] a, int fromIndex, int toIndex, String[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static <T> T[] replaceRange(@NotNull T[] a, int fromIndex, int toIndex, T[] replacement) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a
- the original arrayfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IllegalArgumentException
- if the specified originalArray
isnull
.IndexOutOfBoundsException
- if the range is out of the array bounds
-
replaceRange
public static <T> boolean replaceRange(@NotNull List<T> c, int fromIndex, int toIndex, Collection<? extends T> replacement) throws IllegalArgumentException Replaces a range of elements in the given list with the elements from the replacement collection.- Type Parameters:
T
- the type of elements in the list and replacement collection- Parameters:
c
- the original list to be modifiedfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the collection to replace the specified range in the original list- Returns:
- a boolean indicating whether the list was modified
- Throws:
IllegalArgumentException
- if the specified list isnull
IndexOutOfBoundsException
- if the range is out of the list bounds
-
replaceRange
public static String replaceRange(String str, int fromIndex, int toIndex, String replacement) throws IndexOutOfBoundsException Returns a new String with the specified range replaced with the replacement String.
The original String remains unchanged.- Parameters:
str
- the original stringfromIndex
- the initial index of the range to be replaced, inclusivetoIndex
- the final index of the range to be replaced, exclusivereplacement
- the string to replace the specified range in the original string- Returns:
- a new string with the specified range replaced by the replacement string
- Throws:
IndexOutOfBoundsException
- if the range is out of the string bounds- See Also:
-
moveRange
public static void moveRange(boolean[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(char[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(byte[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(short[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(int[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(long[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(float[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(double[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static <T> void moveRange(T[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a
- the original array to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static <T> boolean moveRange(List<T> c, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given list to a new position within the list.
No elements are deleted in the process, the original list maintains its size.- Type Parameters:
T
- the type of elements in the list- Parameters:
c
- the original list to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, list.size() - (toIndex - fromIndex)]- Returns:
true
if the list was modified as a result of this operation- Throws:
IndexOutOfBoundsException
- if the range is out of the list bounds or newPositionStartIndex is invalid
-
moveRange
public static String moveRange(String str, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Returns a new string with the specified range moved to the new position.
The original String remains unchanged.- Parameters:
str
- the original string to be modifiedfromIndex
- the initial index of the range to be moved, inclusivetoIndex
- the final index of the range to be moved, exclusivenewPositionStartIndex
- must in the range: [0, String.length - (toIndex - fromIndex)]- Returns:
- a new string with the specified range moved to the new position
- Throws:
IndexOutOfBoundsException
- if the range is out of the string bounds or newPositionStartIndex is invalid- See Also:
-
skipRange
public static <T> T[] skipRange(T[] a, int startInclusive, int endExclusive) throws IndexOutOfBoundsException Returns a new array with the specified range skipped.
The original array remains unchanged.- Type Parameters:
T
- the type of elements in the array- Parameters:
a
- the original array to be modifiedstartInclusive
- the initial index of the range to be skipped, inclusiveendExclusive
- the final index of the range to be skipped, exclusive- Returns:
- a new array with the specified range skipped
- Throws:
IndexOutOfBoundsException
- if the range is out of the array bounds
-
skipRange
public static <T> List<T> skipRange(Collection<? extends T> c, int startInclusive, int endExclusive) throws IndexOutOfBoundsException Returns a new list with the specified range skipped.
The original collection remains unchanged.- Type Parameters:
T
- the type of elements in the collection- Parameters:
c
- the original collection to be modifiedstartInclusive
- the initial index of the range to be skipped, inclusiveendExclusive
- the final index of the range to be skipped, exclusive- Returns:
- a new list with the specified range skipped
- Throws:
IndexOutOfBoundsException
- if the range is out of the collection bounds
-
skipRange
public static <T,C extends Collection<T>> C skipRange(Collection<? extends T> c, int startInclusive, int endExclusive, IntFunction<C> supplier) throws IndexOutOfBoundsException Returns a new collection with the specified range skipped.
The original collection remains unchanged.- Type Parameters:
T
- the type of elements in the collectionC
- the type of the collection to be returned- Parameters:
c
- the original collection to be modifiedstartInclusive
- the initial index of the range to be skipped, inclusiveendExclusive
- the final index of the range to be skipped, exclusivesupplier
- a function that creates a new instance of the desired collection type- Returns:
- a new collection with the specified range skipped
- Throws:
IndexOutOfBoundsException
- if the range is out of the collection bounds
-
hasDuplicates
public static boolean hasDuplicates(boolean[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(char[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(char[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(byte[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(byte[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(short[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(short[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(int[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(int[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(long[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(long[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(float[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(float[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(double[] a) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static boolean hasDuplicates(double[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static <T> boolean hasDuplicates(T[] a) Checks if the given array has duplicate elements.- Type Parameters:
T
-- Parameters:
a
- the array to be checked for duplicates- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
public static <T> boolean hasDuplicates(T[] a, boolean isSorted) Checks if the given array has duplicate elements.- Type Parameters:
T
-- Parameters:
a
- the array to be checked for duplicatesisSorted
- a boolean that indicates if the array is sorted. Iftrue
, the algorithm will be faster.- Returns:
true
if the array has duplicates,false
otherwise
-
hasDuplicates
Checks if the given collection has duplicate elements.- Parameters:
c
- the collection to be checked for duplicates- Returns:
true
if the collection has duplicates,false
otherwise
-
hasDuplicates
Checks if the given collection has duplicate elements.- Parameters:
c
- the collection to be checked for duplicatesisSorted
- a boolean that indicates if the collection is sorted. Iftrue
, the algorithm will be faster- Returns:
true
if the collection has duplicates,false
otherwise
-
retainAll
Retains only the elements in the specified collection that are present in the specified collection of elements to keep. In other words, removes from the first collection all of its elements that are not contained in the second collection.- Type Parameters:
T
- the type of elements in the collections- Parameters:
c
- the collection to be modified.objsToKeep
- the collection containing elements to be retained in the first collection.- Returns:
true
if the first collection changed as a result of the call
-
sum
Calculates the sum of the given array of characters. The sum is calculated by adding up the ASCII values of the characters.- Parameters:
a
- the array of characters to sum. If the array isnull
or empty, the method returns 0.- Returns:
- the sum of the ASCII values of the characters in the array.
-
sum
Calculates the sum of the ASCII values of the characters in the given array within the specified range.- Parameters:
a
- the array of characters to sum. If the array isnull
or empty, the method returns 0.fromIndex
- the start index, inclusive.toIndex
- the end index, exclusive.- Returns:
- the sum of the ASCII values of the characters in the specified range of the array.
- Throws:
IndexOutOfBoundsException
- if the range is out of bounds for the given array.
-
sum
Calculates the sum of the bytes in the given array.- Parameters:
a
- the array of bytes to sum. If the array isnull
or empty, the method returns 0.- Returns:
- the sum of the bytes in the array.
-
sum
Calculates the sum of the bytes in the given array within the specified range.- Parameters:
a
- the array of bytes to sum. If the array isnull
or empty, the method returns 0.fromIndex
- the start index, inclusive.toIndex
- the end index, exclusive.- Returns:
- the sum of the bytes in the specified range of the array.
- Throws:
IndexOutOfBoundsException
- if the range is out of bounds for the given array.
-
sum
- Parameters:
a
-- Returns:
- a long number
-
sum
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sum
- Parameters:
a
-- Returns:
- a long number
-
sum
public static int sum(int[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
sumToLong
- Parameters:
a
-- Returns:
- a long number
-
sumToLong
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sum
- Parameters:
a
-- Returns:
- a long number
-
sum
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sum
- Parameters:
a
-- Returns:
-
sum
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sumToDouble
- Parameters:
a
-- Returns:
-
sumToDouble
public static double sumToDouble(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sum
- Parameters:
a
-- Returns:
- a double number
-
sum
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
public static double average(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
public static double average(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
average
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-- Returns:
- a double number
-
average
public static double average(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sumInt
- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
sumInt
- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumInt
- Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumInt
public static <T> int sumInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumInt
- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumInt
public static <T> int sumInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumInt
- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
sumInt
- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
sumIntToLong
- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
sumIntToLong
- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
sumLong
- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
sumLong
- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumLong
public static <T> long sumLong(T[] a, ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumLong
public static <T> long sumLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumLong
public static <T extends Number> long sumLong(Collection<? extends T> c, int fromIndex, int toIndex) - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumLong
public static <T> long sumLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumLong
- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
sumLong
- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
sumDouble
- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
sumDouble
- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumDouble
- Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- See Also:
-
sumDouble
public static <T> double sumDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumDouble
public static <T extends Number> double sumDouble(Collection<? extends T> c, int fromIndex, int toIndex) - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
sumDouble
public static <T> double sumDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
sumDouble
- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
sumDouble
- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
sumBigInteger
Sums the BigInteger values in the provided iterable. If the iterable isnull
,BigInteger.ZERO
is returned.- Parameters:
c
- The iterable of BigInteger values to be summed. This can be any iterable of BigInteger.- Returns:
- The sum of the BigInteger values in the iterable.
- See Also:
-
sumBigInteger
public static <T> BigInteger sumBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Returns the sum of the BigInteger values extracted from the elements in the provided iterable by the inputfunc
function. If the iterable isnull
,BigInteger.ZERO
is returned.- Type Parameters:
T
- The type of elements in the iterable.- Parameters:
c
- The iterable of elements to be processed. This can be any iterable of type T.func
- The function to be applied to each element in the iterable. This function should take an instance of type T and return a BigInteger.- Returns:
- The sum of the BigInteger values extracted from the elements in the iterable by the input function.
- See Also:
-
sumBigDecimal
Sums the BigDecimal values in the provided iterable. If the iterable isnull
,BigDecimal.ZERO
is returned.- Parameters:
c
- The iterable of BigDecimal values to be summed. This can be any iterable of BigDecimal.- Returns:
- The sum of the BigDecimal values in the iterable.
- See Also:
-
sumBigDecimal
public static <T> BigDecimal sumBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Returns the sum of the BigDecimal values extracted from the elements in the provided iterable by the inputfunc
function. If the iterable isnull
,BigDecimal.ZERO
is returned.- Type Parameters:
T
- The type of elements in the iterable.- Parameters:
c
- The iterable of elements to be processed. This can be any iterable of type T.func
- The function to be applied to each element in the iterable. This function should take an instance of type T and return a BigDecimal.- Returns:
- The sum of the BigDecimal values extracted from the elements in the iterable by the input function.
- See Also:
-
averageInt
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
averageInt
Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageInt
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- See Also:
-
averageInt
public static <T> double averageInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageInt
public static <T extends Number> double averageInt(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageInt
public static <T> double averageInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageInt
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
averageInt
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
averageLong
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
averageLong
Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageLong
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- See Also:
-
averageLong
public static <T> double averageLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageLong
public static <T extends Number> double averageLong(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageLong
public static <T> double averageLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageLong
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
averageLong
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
averageDouble
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
averageDouble
Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageDouble
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-func
-- Returns:
- See Also:
-
averageDouble
public static <T> double averageDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageDouble
public static <T extends Number> double averageDouble(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- See Also:
-
averageDouble
public static <T> double averageDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of an Array/Collection within the specified range.
Returns0
if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-func
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
averageDouble
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
averageDouble
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
averageBigInteger
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Parameters:
c
-- Returns:
- See Also:
-
averageBigInteger
public static <T> BigDecimal averageBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
averageBigDecimal
Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Parameters:
c
-- Returns:
- See Also:
-
averageBigDecimal
public static <T> BigDecimal averageBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Calculates the average of an Array/Collection.
Returns0
if the specifiedArray/Collection
isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-func
-- Returns:
- See Also:
-
min
public static char min(char a, char b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static byte min(byte a, byte b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static short min(short a, short b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static int min(int a, int b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static long min(long a, long b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static float min(float a, float b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
public static double min(double a, double b) Returns the minimum value among the provided values.- Parameters:
a
-b
-- Returns:
-
min
Returns the minimum value among the provided values based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
min
Returns the minimum value among the provided values according to the provided comparator.- Type Parameters:
T
- the type of the objects to be compared- Parameters:
a
- the first object to be comparedb
- the second object to be comparedcmp
- the comparator to compare the objects- Returns:
- the minimum of a and b according to the provided comparator
-
min
public static char min(char a, char b, char c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static byte min(byte a, byte b, byte c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static short min(short a, short b, short c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static int min(int a, int b, int c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static long min(long a, long b, long c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static float min(float a, float b, float c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
public static double min(double a, double b, double c) Returns the minimum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
min
Returns the minimum value among the three provided values based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
- the type of the values, which must be a subtype of Comparable- Parameters:
a
- the first value to compareb
- the second value to comparec
- the third value to compare- Returns:
- the minimum value among a, b, and c based on their natural ordering
-
min
Returns the minimum value among the provided values according to the provided comparator.- Type Parameters:
T
- the type of the values- Parameters:
a
- the first value to compareb
- the second value to comparec
- the third value to comparecmp
- the Comparator to compare the values- Returns:
- the minimum value among a, b, and c based on the provided Comparator
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
- the char array to find the minimum value from.fromIndex
- the start index (inclusive) of the subarray.toIndex
- the end index (exclusive) of the subarray.- Returns:
- the minimum value in the specified subarray of the char array.
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values.- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
Returns the minimum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
a
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T extends Comparable<? super T>> T min(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
Returns the minimum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
- anArray
which must not benull
or emptycmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T> T min(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
public static <T extends Comparable<? super T>> T min(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T> T min(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection according to the provided comparator.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
min
public static <T extends Comparable<? super T>> T min(Iterable<? extends T> c) throws IllegalArgumentException Returns the minimum value among the provided values based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T> T min(Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the minimum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T extends Comparable<? super T>> T min(Iterator<? extends T> iter) throws IllegalArgumentException Returns the minimum value among the provided values based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
min
public static <T> T min(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns the minimum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
iter
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
minAll
Returns a list of all the minimum values in the provided values, based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
- the type of the values, which must be a subtype of Comparable- Parameters:
a
- the array to find the minimum values from- Returns:
- a list of the minimum values in the provided array
-
minAll
Returns a list of all the minimum values in the provided array, based on the provided comparator.- Type Parameters:
T
- the type of the values- Parameters:
a
- the array to find the minimum values fromcmp
- the comparator to compare the elements- Returns:
- a list of the minimum values in the provided array
-
minAll
Returns a list of all the minimum values in the provided values, based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
minAll
Returns a list of all the minimum values in the provided array, based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
-
minAll
Returns a list of all the minimum values in the provided values, based on their natural ordering. Null values are considered to be maximum.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- See Also:
-
minAll
Returns a list of all the minimum values in the provided array, based on the provided comparator.- Type Parameters:
T
-- Parameters:
iter
-cmp
-- Returns:
- See Also:
-
minOrDefaultIfEmpty
@Beta public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty. Null values are considered to be maximum.- Type Parameters:
T
-R
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
minOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified collection c byvalueExtractor
, ordefaultValue
if c isnull
or empty. Null values are considered to be maximum.- Type Parameters:
T
-R
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
minOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if iter isnull
or empty. Null values are considered to be maximum.- Type Parameters:
T
-R
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimumint
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimumlong
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimumdouble
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(T[] a) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified array.- Type Parameters:
T
- the type of the values, which must be a subtype of Comparable- Parameters:
a
- the array to find the minimum and maximum values from- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array
- Throws:
IllegalArgumentException
- if the specified array isnull
or- See Also:
-
minMax
public static <T> Pair<T,T> minMax(T[] a, Comparator<? super T> cmp) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified array, based on the provided comparator.- Type Parameters:
T
- the type of the values- Parameters:
a
- the array to find the minimum and maximum values fromcmp
- the comparator to compare the elements- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array
- Throws:
IllegalArgumentException
- if the specified array isnull
or empty- See Also:
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(Iterable<? extends T> c) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified Iterable.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- Throws:
IllegalArgumentException
- if c isnull
or empty.- See Also:
-
minMax
public static <T> Pair<T,T> minMax(@NotNull Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified Iterable, based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if c isnull
or empty.- See Also:
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(Iterator<? extends T> iter) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified Iterator.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- Throws:
IllegalArgumentException
- if iter isnull
or empty.- See Also:
-
minMax
public static <T> Pair<T,T> minMax(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns a pair of the minimum and maximum values in the specified Iterator, based on the provided comparator.- Type Parameters:
T
-- Parameters:
iter
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if iter isnull
or empty.- See Also:
-
max
public static char max(char a, char b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static byte max(byte a, byte b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static short max(short a, short b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static int max(int a, int b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static long max(long a, long b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static float max(float a, float b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
public static double max(double a, double b) Returns the maximum value among the provided values.- Parameters:
a
-b
-- Returns:
-
max
Returns the maximum value among the provided values based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
max
Returns the maximum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
-b
-cmp
-- Returns:
-
max
public static char max(char a, char b, char c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static byte max(byte a, byte b, byte c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static short max(short a, short b, short c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static int max(int a, int b, int c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static long max(long a, long b, long c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static float max(float a, float b, float c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
public static double max(double a, double b, double c) Returns the maximum value among the provided values.- Parameters:
a
-b
-c
-- Returns:
-
max
Returns the maximum value among the provided values based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
-
max
Returns the maximum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
-b
-c
-cmp
-- Returns:
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
Returns the maximum value among the given range in the specified Array/Collection.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
max
Returns the maximum value among the provided values based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
Returns the maximum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
- anArray
which must not benull
or emptycmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T> T max(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the maximum value among the given range in the specified Array/Collection according to the provided comparator.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException Returns the minimum value among the given range in the specified Array/Collection based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T> T max(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException Returns the maximum value among the given range in the specified Array/Collection according to the provided comparator.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Iterable<? extends T> c) throws IllegalArgumentException Returns the maximum value among the provided values based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T> T max(Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the maximum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Iterator<? extends T> iter) throws IllegalArgumentException Returns the maximum value among the provided values based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
max
public static <T> T max(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns the maximum value among the provided values according to the provided comparator.- Type Parameters:
T
-- Parameters:
iter
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
maxAll
Returns a list of all the maximum values in the provided values, based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
maxAll
Returns a list of all the maximum values in the provided values, based on the provided comparator.- Type Parameters:
T
-- Parameters:
a
-cmp
-- Returns:
-
maxAll
Returns a list of all the maximum values in the provided values, based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
maxAll
Returns a list of all the maximum values in the provided values, based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
-
maxAll
Returns a list of all the maximum values in the provided values, based on their natural ordering. Null values are considered to be minimum.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
-
maxAll
Returns a list of all the maximum values in the provided values, based on the provided comparator.- Type Parameters:
T
-- Parameters:
iter
-cmp
-- Returns:
-
maxOrDefaultIfEmpty
@Beta public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty. Null values are considered to be minimum.- Type Parameters:
T
-R
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
maxOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified collection c byvalueExtractor
, ordefaultValue
if c isnull
or empty. Null values are considered to be minimum.- Type Parameters:
T
-R
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
maxOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if iter isnull
or empty. Null values are considered to be minimum.- Type Parameters:
T
-R
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximumint
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximumlong
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified array a byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
a
-valueExtractor
-defaultValue
-- Returns:
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified iterable c byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
c
-valueExtractor
-defaultValue
-- Returns:
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximumdouble
value extracted from the specified iterator iter byvalueExtractor
, ordefaultValue
if a isnull
or empty.- Type Parameters:
T
-- Parameters:
iter
-valueExtractor
-defaultValue
-- Returns:
-
median
public static char median(char a, char b, char c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static byte median(byte a, byte b, byte c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static short median(short a, short b, short c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static int median(int a, int b, int c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static long median(long a, long b, long c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static float median(float a, float b, float c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
public static double median(double a, double b, double c) Returns the median of provided values.- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
Returns the median of provided values.- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
- See Also:
-
median
Returns the median of the provided values based on the provided comparator.- Type Parameters:
T
-- Parameters:
a
-b
-c
-cmp
-- Returns:
- See Also:
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static char median(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
- the array of char valuesfromIndex
- the start index (inclusive) of the range to consider in the arraytoIndex
- the end index (exclusive) of the range to consider in the array- Returns:
- the median of the char values in the specified range of the array
- Throws:
IndexOutOfBoundsException
- if the range is out of the array boundsIllegalArgumentException
- if the specified array isnull
or empty, or if fromIndex equals toIndex
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static byte median(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static short median(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static int median(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static long median(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static float median(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static double median(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.
-
median
Returns thelength / 2 + 1
largest value in the specified array.- Type Parameters:
T
-- Parameters:
a
- anArray
which must not benull
or empty- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T extends Comparable<? super T>> T median(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException Returns the median of the specified values within the given range- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.- Type Parameters:
T
-- Parameters:
a
- anArray
which must not benull
or emptycmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T> T median(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the median of the specified values within the given range based on the provided comparator.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T extends Comparable<? super T>> T median(Collection<? extends T> c) throws IllegalArgumentException Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T extends Comparable<? super T>> T median(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException Returns the median of the specified values within the given range- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T> T median(Collection<? extends T> c, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns thelength / 2 + 1
largest value in the provided values based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
median
public static <T> T median(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException Returns the median of the specified values within the given range based on the provided comparator.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, orfromIndex == toIndex
.- See Also:
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static char kthLargest(char[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static byte kthLargest(byte[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static short kthLargest(short[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static int kthLargest(int[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static long kthLargest(long[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static float kthLargest(float[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
Returns the kth largest element in the specified array/collection.- Parameters:
a
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static double kthLargest(double[] a, int fromIndex, int toIndex, int k) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(T[] a, int k) throws IllegalArgumentException Returns the kth largest element in the specified array/collection.- Type Parameters:
T
- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a
- The array from which to find the kth largest element.k
- The position from the largest element to return.- Returns:
- The kth largest element from the array.
- Throws:
IllegalArgumentException
- if the provided array isnull
or its length is less than k.- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(T[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.- See Also:
-
kthLargest
public static <T> T kthLargest(T[] a, int k, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection.- Type Parameters:
T
-- Parameters:
a
-k
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.- See Also:
-
kthLargest
public static <T> T kthLargest(T[] a, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) throws IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The array from which to find the kth largest element.fromIndex
- The start index for the range to be searched.toIndex
- The end index for the range to be searched.k
- The position from the largest element to return.cmp
- The comparator to determine the order of the array.- Returns:
- The kth largest element from the array.
- Throws:
IllegalArgumentException
- if the provided array isnull
, its length is less than k, or the range fromIndex to toIndex is less than k.- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(Collection<? extends T> c, int k) throws IllegalArgumentException Returns the kth largest element in the specified array/collection.- Type Parameters:
T
- The type of the elements in the collection. It must be a type that implements Comparable.- Parameters:
c
- The collection from which to find the kth largest element.k
- The position from the largest element to return.- Returns:
- The kth largest element from the collection.
- Throws:
IllegalArgumentException
- if the provided collection isnull
or its size is less than k.- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k) throws IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-k
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.- See Also:
-
kthLargest
public static <T> T kthLargest(Collection<? extends T> c, int k, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the kth largest element in the specified array/collection.- Type Parameters:
T
-- Parameters:
c
-k
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
IllegalArgumentException
- if the specifiedArray/Collection
isnull
or empty, or its length/size is less thank
, ortoIndex - fromIndex < k
.- See Also:
-
kthLargest
public static <T> T kthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) throws IllegalArgumentException Returns the kth largest element in the specified array/collection within the given range.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The collection from which to find the kth largest element.fromIndex
- The start index for the range to be searched.toIndex
- The end index for the range to be searched.k
- The position from the largest element to return.cmp
- The comparator to determine the order of the collection.- Returns:
- The kth largest element from the collection.
- Throws:
IllegalArgumentException
- if the provided collection isnull
, its size is less than k, or the range fromIndex to toIndex is less than k.- See Also:
-
top
public static short[] top(short[] a, int n) Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.- Returns:
- A short array containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-cmp
-- Returns:
-
top
public static short[] top(short[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative.
-
top
public static short[] top(short[] a, int fromIndex, int toIndex, int n, Comparator<? super Short> cmp) throws IllegalArgumentException Returns the top n elements from a specified range of the array, sorted according to the provided comparator.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.cmp
- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative or if 'fromIndex' or 'toIndex' are out of the array's bounds.
-
top
public static int[] top(int[] a, int n) Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-- Returns:
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-cmp
-- Returns:
-
top
public static int[] top(int[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative.
-
top
public static int[] top(int[] a, int fromIndex, int toIndex, int n, Comparator<? super Integer> cmp) throws IllegalArgumentException Returns the top n elements from a specified range of the array, sorted according to the provided comparator.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.cmp
- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative or if 'fromIndex' or 'toIndex' are out of the array's bounds.
-
top
public static long[] top(long[] a, int n) Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-- Returns:
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-cmp
-- Returns:
-
top
public static long[] top(long[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative.
-
top
public static long[] top(long[] a, int fromIndex, int toIndex, int n, Comparator<? super Long> cmp) throws IllegalArgumentException Returns the top n elements from a specified range of the array, sorted according to the provided comparator.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.cmp
- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative or if 'fromIndex' or 'toIndex' are out of the array's bounds.
-
top
public static float[] top(float[] a, int n) Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-- Returns:
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
-n
-cmp
-- Returns:
-
top
public static float[] top(float[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range of the array.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative.
-
top
public static float[] top(float[] a, int fromIndex, int toIndex, int n, Comparator<? super Float> cmp) throws IllegalArgumentException Returns the top n elements from a specified range of the array, sorted according to the provided comparator.- Parameters:
a
- the array to select the top elements from.fromIndex
- the start index (inclusive) of the range.toIndex
- the end index (exclusive) of the range.n
- the number of top elements to select.cmp
- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range of the input array.
- Throws:
IllegalArgumentException
- if n is negative or if 'fromIndex' or 'toIndex' are out of the array's bounds.
-
top
public static double[] top(double[] a, int n) Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.- Returns:
- An array containing the top n elements from the original array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements. Ifnull
, the natural ordering of the elements will be used.- Returns:
- An array containing the top n elements from the original array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static double[] top(double[] a, int fromIndex, int toIndex, int n) Returns the top n elements from the provided array, based on their natural ordering. The elements are selected from the specified range (fromIndex, toIndex) in the array. If there are less than n elements in the specified range, all the elements from the range will be included in the returned array.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index in the array from which to select the top n elements.toIndex
- The end index in the array to which to select the top n elements.n
- The number of top elements to return.- Returns:
- An array containing the top n elements from the original array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static double[] top(double[] a, int fromIndex, int toIndex, int n, Comparator<? super Double> cmp) throws IllegalArgumentException Returns the top n elements from the provided array, based on the provided comparator. The elements are selected from the specified range (fromIndex, toIndex) in the array. If there are less than n elements in the specified range, all the elements from the range will be included in the returned array.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index in the array from which to select the top n elements.toIndex
- The end index in the array to which to select the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.- Returns:
- An array containing the top n elements from the original array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, all the elements will be included to returned list.- Type Parameters:
T
- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided array. If there are less than n elements in the array, all the elements will be included to returned list.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.cmp
- The Comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int fromIndex, int toIndex, int n) Returns the top n elements from the provided array, based on their natural ordering. If there are less than n elements in the range specified byfromIndex
andtoIndex
, all the elements from that range will be included to returned list.- Type Parameters:
T
- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index for the range to be searched.toIndex
- The end index for the range to be searched.n
- The number of top elements to return.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) throws IllegalArgumentException Returns the top n elements from the provided array, based on the provided comparator. The elements are selected from the range specified byfromIndex
andtoIndex
. If there are less than n elements in the range, all the elements from that range will be included in the returned list.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index for the range to be searched.toIndex
- The end index for the range to be searched.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided collection, based on natural ordering of the elements. The elements are selected based on their natural ordering (from smallest to largest). If there are less than n elements in the collection, all the elements from the collection will be included in the returned list.- Type Parameters:
T
- The type of the elements in the collection. The type must be a subclass ofComparable
.- Parameters:
c
- The collection from which to find the top n elements.n
- The number of top elements to return.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided collection, based on the provided comparator. The elements are selected based on the order determined by the comparator. If there are less than n elements in the collection, all the elements from the collection will be included in the returned list.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The collection from which to find the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n) Returns the top n elements from the provided collection, based on natural ordering of the elements. The elements are selected based on their natural ordering (from smallest to largest). If there are less than n elements in the collection, all the elements from the collection will be included in the returned list.- Type Parameters:
T
- The type of the elements in the collection. The type must be a subclass ofComparable
.- Parameters:
c
- The collection from which to find the top n elements.fromIndex
- The start index in the collection from which to select the top n elements.toIndex
- The end index in the collection to which to select the top n elements.n
- The number of top elements to return.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) throws IllegalArgumentException Returns the top n elements from the provided collection, based on the provided comparator. The elements are selected based on the order determined by the comparator. If there are less than n elements in the collection, all the elements from the collection will be included in the returned list.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The collection from which to find the top n elements.fromIndex
- The start index in the collection from which to select the top n elements.toIndex
- The end index in the collection to which to select the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int n, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on natural ordering of the elements. The elements are selected based on their natural ordering (from smallest to largest). If there are less than n elements in the array, all the elements from the array will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the array if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the array. The type must be a subclass ofComparable
.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
Returns the top n elements from the provided array, based on the provided comparator. The elements are selected based on the order determined by the comparator. If there are less than n elements in the array, all the elements from the array will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the array if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The array from which to find the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the provided array, based on the natural ordering of the elements. The elements are selected from the specified range in the array (from 'fromIndex' inclusive to 'toIndex' exclusive). If there are less than n elements in the specified range, all the elements from the range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the array if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the array. The type must be a subclass ofComparable
.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index (inclusive) in the array to consider for the operation.toIndex
- The end index (exclusive) in the array to consider for the operation.n
- The number of top elements to return.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) throws IllegalArgumentException Returns the top n elements from the provided array, based on the provided comparator. The elements are selected from the specified range in the array (from 'fromIndex' inclusive to 'toIndex' exclusive). If there are less than n elements in the specified range, all the elements from the range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the array if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the array.- Parameters:
a
- The array from which to find the top n elements.fromIndex
- The start index (inclusive) in the array to consider for the operation.toIndex
- The end index (exclusive) in the array to consider for the operation.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the array.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int n, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the natural ordering of the elements. The elements are selected based on their natural ordering (from smallest to largest). If there are less than n elements in the Collection, all the elements from the array will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the collection if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the collection. The type must be a subclass ofComparable
.- Parameters:
c
- The collection from which to find the top n elements.n
- The number of top elements to return.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T> List<T> top(Collection<? extends T> c, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the provided comparator. The elements are selected based on their ordering defined by the comparator (from smallest to largest). If there are less than n elements in the Collection, all the elements from the collection will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the collection if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The collection from which to find the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the provided collection, based on the natural ordering of the elements. The elements are selected from the specified range (fromIndex, toIndex) in the collection. If there are less than n elements in the specified range, all the elements from the range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the collection if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the collection. The type must be a subclass ofComparable
.- Parameters:
c
- The collection from which to find the top n elements.fromIndex
- The start index in the collection from which to select the top n elements.toIndex
- The end index in the collection to which to select the top n elements.n
- The number of top elements to return.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
top
public static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) throws IllegalArgumentException Returns the top n elements from the provided collection, based on the provided comparator. The elements are selected from the specified range (fromIndex, toIndex) in the collection. If there are less than n elements in the specified range, all the elements from the range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the collection if 'keepEncounterOrder' istrue
.- Type Parameters:
T
- The type of the elements in the collection.- Parameters:
c
- The collection from which to find the top n elements.fromIndex
- The start index in the collection from which to select the top n elements.toIndex
- The end index in the collection to which to select the top n elements.n
- The number of top elements to return.cmp
- The comparator to determine the order of the elements.keepEncounterOrder
- Iftrue
, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException
- if the specified n is negative.
-
percentiles
public static Map<Percentage,Character> percentiles(char[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of characters.- Parameters:
sortedArray
- The sorted array of characters for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding characters from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
Calculates the percentiles of the provided sorted array of bytes.- Parameters:
sortedArray
- The sorted array of bytes for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding bytes from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
public static Map<Percentage,Short> percentiles(short[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of shorts.- Parameters:
sortedArray
- The sorted array of shorts for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding shorts from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
public static Map<Percentage,Integer> percentiles(int[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of integers.- Parameters:
sortedArray
- The sorted array of integers for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding integers from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
Calculates the percentiles of the provided sorted array of longs.- Parameters:
sortedArray
- The sorted array of longs for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding longs from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
public static Map<Percentage,Float> percentiles(float[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of floats.- Parameters:
sortedArray
- The sorted array of floats for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding floats from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
public static Map<Percentage,Double> percentiles(double[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of doubles.- Parameters:
sortedArray
- The sorted array of doubles for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding doubles from the array.
- Throws:
IllegalArgumentException
- if the provided array is empty.
-
percentiles
Calculates the percentiles of the provided sorted array.- Type Parameters:
T
- The type of elements in the array.- Parameters:
sortedArray
- The array for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding elements from the array.
- Throws:
IllegalArgumentException
- if the provided array isnull
or empty.
-
percentiles
Calculates the percentiles of the provided sorted list.- Type Parameters:
T
- The type of elements in the list.- Parameters:
sortedList
- The sorted list for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding elements from the list.
- Throws:
IllegalArgumentException
- if the provided list isnull
or empty.
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
- Parameters:
a
-max
-filter
-- Returns:
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static boolean[] filter(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter, int max) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static char[] filter(char[] a, CharPredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static char[] filter(char[] a, int fromIndex, int toIndex, CharPredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static byte[] filter(byte[] a, BytePredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static byte[] filter(byte[] a, int fromIndex, int toIndex, BytePredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static short[] filter(short[] a, ShortPredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static short[] filter(short[] a, int fromIndex, int toIndex, ShortPredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
- Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static int[] filter(int[] a, int fromIndex, int toIndex, IntPredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static long[] filter(long[] a, LongPredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static long[] filter(long[] a, int fromIndex, int toIndex, LongPredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static float[] filter(float[] a, FloatPredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static float[] filter(float[] a, int fromIndex, int toIndex, FloatPredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Parameters:
a
-filter
-- Returns:
-
filter
public static double[] filter(double[] a, DoublePredicate filter, int max) throws IllegalArgumentException - Parameters:
a
-filter
-max
-- Returns:
- Throws:
IllegalArgumentException
-
filter
- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static double[] filter(double[] a, int fromIndex, int toIndex, DoublePredicate filter, int max) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-max
- maximum return result.- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
Returns a list of values filtered by the specified predicate.- Type Parameters:
T
- the type of the elements in the array- Parameters:
a
- the array to filterfilter
- the predicate to apply to each element in the array- Returns:
- a list containing the elements of the array that match the predicate
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, Predicate<? super T> filter, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.- Type Parameters:
T
-C
-- Parameters:
a
-filter
-supplier
-- Returns:
-
filter
Returns a list of values filtered by the specified predicate.- Type Parameters:
T
-- Parameters:
a
-filter
-max
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, Predicate<? super T> filter, int max, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.- Type Parameters:
T
-C
-- Parameters:
a
-filter
-max
-supplier
-- Returns:
-
filter
Returns a list of values filtered by the specified predicate.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) Returns a list of values filtered by the specified predicate.- Type Parameters:
T
-C
-- Parameters:
a
-fromIndex
-toIndex
-filter
-supplier
-- Returns:
-
filter
public static <T> List<T> filter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, int max) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-filter
-max
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, int max, IntFunction<C> supplier) throws IllegalArgumentException, IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-C
-- Parameters:
a
-fromIndex
-toIndex
-filter
-max
-supplier
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
filter
- Type Parameters:
T
-- Parameters:
c
-filter
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(Iterable<? extends T> c, Predicate<? super T> filter, IntFunction<C> supplier) - Type Parameters:
T
-C
-- Parameters:
c
-filter
-supplier
-- Returns:
-
filter
- Type Parameters:
T
-- Parameters:
c
-filter
-max
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(Iterable<? extends T> c, Predicate<? super T> filter, int max, IntFunction<C> supplier) throws IllegalArgumentException - Type Parameters:
T
-C
-- Parameters:
c
-filter
-max
-supplier
-- Returns:
- Throws:
IllegalArgumentException
-
filter
public static <T> List<T> filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-filter
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) - Type Parameters:
T
-C
-- Parameters:
c
-fromIndex
-toIndex
-filter
-supplier
-- Returns:
-
filter
public static <T> List<T> filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, int max) - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-filter
-max
-- Returns:
-
filter
public static <T,C extends Collection<T>> C filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, int max, IntFunction<C> supplier) throws IllegalArgumentException, IndexOutOfBoundsException - Type Parameters:
T
-C
-- Parameters:
c
-fromIndex
-toIndex
-filter
-max
-supplier
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
mapToBoolean
Map to boolean.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToBoolean
public static <T> boolean[] mapToBoolean(T[] a, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToBoolean
public static <T> boolean[] mapToBoolean(Collection<? extends T> c, ToBooleanFunction<? super T> mapper) Map to boolean.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToBoolean
public static <T> boolean[] mapToBoolean(Collection<? extends T> c, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToChar
Map to char.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToChar
public static <T> char[] mapToChar(T[] a, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToChar
Map to char.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToChar
public static <T> char[] mapToChar(Collection<? extends T> c, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToByte
Map to byte.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToByte
public static <T> byte[] mapToByte(T[] a, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToByte
Map to byte.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToByte
public static <T> byte[] mapToByte(Collection<? extends T> c, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToShort
Map to short.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToShort
public static <T> short[] mapToShort(T[] a, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToShort
Map to short.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToShort
public static <T> short[] mapToShort(Collection<? extends T> c, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToInt
Map to int.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToInt
public static <T> int[] mapToInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToInt
Map to int.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToInt
public static <T> int[] mapToInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToInt
- Parameters:
a
-mapper
-- Returns:
-
mapToInt
- Parameters:
a
-mapper
-- Returns:
-
mapToLong
Map to long.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToLong
public static <T> long[] mapToLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToLong
Map to long.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToLong
public static <T> long[] mapToLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToLong
- Parameters:
a
-mapper
-- Returns:
-
mapToLong
- Parameters:
a
-mapper
-- Returns:
-
mapToFloat
Map to float.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToFloat
public static <T> float[] mapToFloat(T[] a, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToFloat
Map to float.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToFloat
public static <T> float[] mapToFloat(Collection<? extends T> c, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToDouble
Map to double.- Type Parameters:
T
-- Parameters:
a
-mapper
-- Returns:
-
mapToDouble
public static <T> double[] mapToDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToDouble
public static <T> double[] mapToDouble(Collection<? extends T> c, ToDoubleFunction<? super T> mapper) Map to double.- Type Parameters:
T
-- Parameters:
c
-mapper
-- Returns:
-
mapToDouble
public static <T> double[] mapToDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
IndexOutOfBoundsException
-
mapToDouble
- Parameters:
a
-mapper
-- Returns:
-
mapToDouble
- Parameters:
a
-mapper
-- Returns:
-
map
Transforms an array of elements into a list by applying a given function to each element.- Type Parameters:
T
- The type of the elements in the input array.R
- The type of the elements in the resulting list.- Parameters:
a
- The input array to be transformed. Must not benull
.mapper
- The function to apply to each element in the input array. Must not benull
.- Returns:
- A list containing the transformed elements.
-
map
public static <T,R, C mapC extends Collection<R>> (T[] a, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) - Type Parameters:
T
-R
-C
-- Parameters:
a
-mapper
-supplier
-- Returns:
-
map
public static <T,R> List<R> map(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
-
map
public static <T,R, C mapC extends Collection<R>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
map
public static <T,R> List<R> map(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
-
map
public static <T,R, C mapC extends Collection<R>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
map
- Type Parameters:
T
-R
-- Parameters:
c
-mapper
-- Returns:
-
map
public static <T,R, C mapC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) - Type Parameters:
T
-R
-C
-- Parameters:
c
-mapper
-supplier
-- Returns:
-
flatMap
public static <T,R> List<R> flatMap(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms an array of elements into a list by applying a given function to each element and flattening the result.- Type Parameters:
T
- The type of the elements in the input array.R
- The type of the elements in the resulting list.- Parameters:
a
- The input array to be transformed. Must not benull
.mapper
- The function to apply to each element in the input array. Must not benull
.- Returns:
- A list containing the transformed elements.
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (T[] a, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) - Type Parameters:
T
-R
-C
-- Parameters:
a
-mapper
-supplier
-- Returns:
-
flatMap
public static <T,R> List<R> flatMap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
flatMap
public static <T,R> List<R> flatMap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
flatMap
public static <T,R> List<R> flatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper) - Type Parameters:
T
-R
-- Parameters:
c
-mapper
-- Returns:
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException- Type Parameters:
T
-R
-C
-- Parameters:
c
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
flatMap
public static <T,U, List<R> flatMapR> (T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) - Type Parameters:
T
-U
-R
-- Parameters:
a
-mapper
-mapper2
-- Returns:
-
flatMap
public static <T,U, C flatMapR, C extends Collection<R>> (T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-U
-R
-C
-- Parameters:
a
-mapper
-mapper2
-supplier
-- Returns:
-
flatMap
public static <T,U, List<R> flatMapR> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) - Type Parameters:
T
-U
-R
-- Parameters:
c
-mapper
-mapper2
-- Returns:
-
flatMap
public static <T,U, C flatMapR, C extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-U
-R
-C
-- Parameters:
c
-mapper
-mapper2
-supplier
-- Returns:
-
flatmap
- Type Parameters:
T
-R
-- Parameters:
a
-mapper
-- Returns:
-
flatmap
public static <T,R, C flatmapC extends Collection<R>> (T[] a, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) - Type Parameters:
T
-R
-C
-- Parameters:
a
-mapper
-supplier
-- Returns:
-
flatmap
public static <T,R> List<R> flatmap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-- Returns:
-
flatmap
public static <T,R, C flatmapC extends Collection<R>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
a
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
flatmap
public static <T,R> List<R> flatmap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-- Returns:
-
flatmap
public static <T,R, C flatmapC extends Collection<R>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-R
-C
-- Parameters:
c
-fromIndex
-toIndex
-mapper
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
flatmap
public static <T,R> List<R> flatmap(Iterable<? extends T> c, Function<? super T, ? extends R[]> mapper) - Type Parameters:
T
-R
-- Parameters:
c
-mapper
-- Returns:
-
flatmap
public static <T,R, C flatmapC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends R[]> mapper, IntFunction<? extends C> supplier) - Type Parameters:
T
-R
-C
-- Parameters:
c
-mapper
-supplier
-- Returns:
-
takeWhile
Returns a list containing the elements of the input array until the provided predicate returnsfalse
.- Type Parameters:
T
-- Parameters:
a
- the array to process.filter
- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element until the predicate returns
false
.
-
takeWhile
Returns a list containing the elements of the inputiterable
until the provided predicate returnsfalse
.- Type Parameters:
T
-- Parameters:
c
- theiterable
to process.filter
- the predicate to apply to elements of theiterable
.- Returns:
- a list of elements from the input
iterable
starting from the first element until the predicate returnsfalse
.
-
takeWhileInclusive
Returns a list containing the elements of the input array until the provided predicate returnsfalse
, including the element that fails the predicate.- Parameters:
a
- the array to process.filter
- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element until the predicate returns
false
, including the element that fails the predicate.
-
takeWhileInclusive
Returns a list containing the elements of the inputiterable
until the provided predicate returnsfalse
, including the element that fails the predicate.- Parameters:
c
- theiterable
to process.filter
- the predicate to apply to elements of theiterable
.- Returns:
- a list of elements from the input
iterable
starting from the first element until the predicate returnsfalse
, including the element that fails the predicate.
-
dropWhile
Returns a list containing the elements of the input array after dropping the elements that satisfy the provided predicate.- Parameters:
a
- the array to process.filter
- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element that fails the predicate.
-
dropWhile
Returns a list containing the elements of the inputiterable
after dropping the elements that satisfy the provided predicate.- Parameters:
c
- theiterable
to process.filter
- the predicate to apply to elements of theiterable
.- Returns:
- a list of elements from the input
iterable
starting from the first element that fails the predicate.
-
skipUntil
Returns a list containing the elements of the input array starting from the first element that satisfies the provided predicate.- Parameters:
a
- the array to process.filter
- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element that satisfies the predicate.
-
skipUntil
Returns a list containing the elements of the inputiterable
starting from the first element that satisfies the provided predicate.- Parameters:
c
- theiterable
to process.filter
- the predicate to apply to elements of theiterable
.- Returns:
- a list of elements from the input
iterable
starting from the first element that satisfies the predicate.
-
distinct
public static boolean[] distinct(boolean[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static boolean[] distinct(boolean[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static char[] distinct(char[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static char[] distinct(char[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static byte[] distinct(byte[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static byte[] distinct(byte[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static short[] distinct(short[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static short[] distinct(short[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static int[] distinct(int[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static int[] distinct(int[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static long[] distinct(long[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static long[] distinct(long[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static float[] distinct(float[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static float[] distinct(float[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
public static double[] distinct(double[] a) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-- Returns:
-
distinct
public static double[] distinct(double[] a, int fromIndex, int toIndex) Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
distinct
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
distinct
public static <T> List<T> distinct(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
distinct
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
distinct
- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- See Also:
-
distinct
public static <T> List<T> distinct(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
distinctBy
Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-keyMapper
- don't change value of the input parameter.- Returns:
-
distinctBy
public static <T> List<T> distinctBy(T[] a, int fromIndex, int toIndex, Function<? super T, ?> keyMapper) throws IndexOutOfBoundsExceptionDistinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-keyMapper
- don't change value of the input parameter.- Returns:
- Throws:
IndexOutOfBoundsException
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(T[] a, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-C
-- Parameters:
a
-keyMapper
- don't change value of the input parameter.supplier
-- Returns:
-
distinctBy
public static <T> List<T> distinctBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ?> keyMapper) throws IndexOutOfBoundsExceptionDistinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-keyMapper
- don't change value of the input parameter.- Returns:
- Throws:
IndexOutOfBoundsException
-
distinctBy
Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-keyMapper
- don't change value of the input parameter.- Returns:
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(Iterable<? extends T> c, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-C
-- Parameters:
c
-keyMapper
- don't change value of the input parameter.supplier
-- Returns:
-
distinctBy
Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
iter
-keyMapper
- don't change value of the input parameter.- Returns:
- See Also:
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(Iterator<? extends T> iter, Function<? super T, ?> keyMapper, Supplier<C> supplier) Distinct by the value mapped fromkeyMapper
. Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-C
-- Parameters:
iter
-keyMapper
- don't change value of the input parameter.supplier
-- Returns:
- See Also:
-
allMatch
- Type Parameters:
T
-- Parameters:
a
-filter
-- Returns:
-
allMatch
- Type Parameters:
T
-- Parameters:
c
-filter
-- Returns:
-
allMatch
- Type Parameters:
T
-- Parameters:
iter
-filter
-- Returns:
-
anyMatch
- Type Parameters:
T
-- Parameters:
a
-filter
-- Returns:
-
anyMatch
- Type Parameters:
T
-- Parameters:
c
-filter
-- Returns:
-
anyMatch
- Type Parameters:
T
-- Parameters:
iter
-filter
-- Returns:
-
noneMatch
- Type Parameters:
T
-- Parameters:
a
-filter
-- Returns:
-
noneMatch
- Type Parameters:
T
-- Parameters:
c
-filter
-- Returns:
-
noneMatch
- Type Parameters:
T
-- Parameters:
iter
-filter
-- Returns:
-
nMatch
Checks if a certain number of elements in the array match the provided predicate.- Type Parameters:
T
- the type of elements in the array- Parameters:
a
- the array to be checkedatLeast
- the minimum number of elements that should match the predicateatMost
- the maximum number of elements that should match the predicatefilter
- the predicate to apply to elements in the array- Returns:
true
if the number of matching elements is within the specified range (inclusive),false
otherwise
-
nMatch
public static <T> boolean nMatch(Iterable<? extends T> c, int atLeast, int atMost, Predicate<? super T> filter) Checks if a certain number of elements in theiterable
match the provided predicate.- Type Parameters:
T
- the type of elements in theiterable
- Parameters:
c
- theiterable
to be checkedatLeast
- the minimum number of elements that should match the predicateatMost
- the maximum number of elements that should match the predicatefilter
- the predicate to apply to elements in theiterable
- Returns:
true
if the number of matching elements is within the specified range (inclusive),false
otherwise
-
nMatch
public static <T> boolean nMatch(Iterator<? extends T> iter, int atLeast, int atMost, Predicate<? super T> filter) Checks if a certain number of elements in the iterator match the provided predicate.- Type Parameters:
T
- the type of elements in the iterator- Parameters:
iter
- the iterator to be checkedatLeast
- the minimum number of elements that should match the predicateatMost
- the maximum number of elements that should match the predicatefilter
- the predicate to apply to elements in the iterator- Returns:
true
if the number of matching elements is within the specified range (inclusive),false
otherwise
-
allTrue
public static boolean allTrue(boolean[] a) - Parameters:
a
-- Returns:
-
allFalse
public static boolean allFalse(boolean[] a) - Parameters:
a
-- Returns:
-
anyTrue
public static boolean anyTrue(boolean[] a) - Parameters:
a
-- Returns:
-
anyFalse
public static boolean anyFalse(boolean[] a) - Parameters:
a
-- Returns:
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
public static int count(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(char[] a, int fromIndex, int toIndex, CharPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(byte[] a, int fromIndex, int toIndex, BytePredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(short[] a, int fromIndex, int toIndex, ShortPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(int[] a, int fromIndex, int toIndex, IntPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(long[] a, int fromIndex, int toIndex, LongPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
-
count
public static int count(float[] a, int fromIndex, int toIndex, FloatPredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
public static int count(double[] a, int fromIndex, int toIndex, DoublePredicate filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
public static <T> int count(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
public static <T> int count(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-filter
-- Returns:
- Throws:
IndexOutOfBoundsException
-
count
Mostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation.- Type Parameters:
T
-- Parameters:
c
-filter
-- Returns:
-
count
Counts the number of elements in the given iterator.- Parameters:
iter
-- Returns:
- Throws:
ArithmeticException
- if the totalcount
overflows anint
.- See Also:
-
count
public static <T> int count(Iterator<? extends T> iter, Predicate<? super T> filter) throws ArithmeticException Counts the number of elements in the given iterator that match the provided predicate.- Type Parameters:
T
- The type of the elements in the iterator.- Parameters:
iter
- The iterator to be counted.filter
- The predicate to apply to each element.- Returns:
- The number of elements that match the predicate.
- Throws:
ArithmeticException
- if the total matchedcount
overflows anint
.- See Also:
-
merge
public static <T> List<T> merge(T[] a, T[] b, BiFunction<? super T, ? super T, MergeResult> nextSelector) - Type Parameters:
T
-- Parameters:
a
-b
-nextSelector
-- Returns:
-
merge
public static <T> List<T> merge(Iterable<? extends T> a, Iterable<? extends T> b, BiFunction<? super T, ? super T, MergeResult> nextSelector) - Type Parameters:
T
-- Parameters:
a
-b
-nextSelector
-- Returns:
-
merge
public static <T> List<T> merge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector) - Type Parameters:
T
-- Parameters:
c
-nextSelector
-- Returns:
-
merge
public static <T,C extends Collection<T>> C merge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector, IntFunction<? extends C> supplier) - Type Parameters:
T
-C
-- Parameters:
c
-nextSelector
-supplier
-- Returns:
-
zip
public static <A,B, List<R> zipR> (A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipR> (Iterable<A> a, Iterable<B> b, BiFunction<? super A, ? super B, ? extends R> zipFunction) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipC, R> (A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipC, R> (Iterable<A> a, Iterable<B> b, Iterable<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipR> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipR> (Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipC, R> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
zip
public static <A,B, List<R> zipC, R> (Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
zip
public static <A,B, R[] zipR> (A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-zipFunction
-targetElementType
-- Returns:
-
zip
public static <A,B, R[] zipR> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) - Type Parameters:
A
-B
-R
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-zipFunction
-targetElementType
-- Returns:
-
zip
public static <A,B, R[] zipC, R> (A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-zipFunction
-targetElementType
-- Returns:
-
zip
public static <A,B, R[] zipC, R> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) - Type Parameters:
A
-B
-C
-R
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-targetElementType
-- Returns:
-
unzip
public static <T,A, Pair<List<A>,B> List<B>> unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip) - Type Parameters:
T
-A
-B
-- Parameters:
c
-unzip
- the second parameter is an output parameter.- Returns:
-
unzip
public static <T,A, Pair<LC,B, LC extends Collection<A>, RC extends Collection<B>> RC> unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip, IntFunction<? extends Collection<?>> supplier) - Type Parameters:
T
-A
-B
-LC
-RC
-- Parameters:
c
-unzip
- the second parameter is an output parameter.supplier
-- Returns:
-
unzipp
@Deprecated public static <T,A, Triple<List<A>,B, C> List<B>, unzippList<C>> (Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)
- Type Parameters:
T
-A
-B
-C
-- Parameters:
c
-unzip
- the second parameter is an output parameter.- Returns:
- See Also:
-
unzipp
@Deprecated public static <T,A, Triple<LC,B, C, LC extends Collection<A>, MC extends Collection<B>, RC extends Collection<C>> MC, unzippRC> (Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip, IntFunction<? extends Collection<?>> supplier) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)
- Type Parameters:
T
-A
-B
-C
-LC
-MC
-RC
-- Parameters:
c
-unzip
- the second parameter is an output parameter.supplier
-- Returns:
- See Also:
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(T[] a, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
a
-keyExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (T[] a, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-M
-- Parameters:
a
-keyExtractor
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
a
-fromIndex
-toIndex
-keyExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) throws IndexOutOfBoundsException- Type Parameters:
T
-K
-M
-- Parameters:
a
-fromIndex
-toIndex
-keyExtractor
-mapSupplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
c
-keyExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-M
-- Parameters:
c
-keyExtractor
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
iter
-keyExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-M
-- Parameters:
iter
-keyExtractor
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <T,K, Map<K,V> List<V>> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) - Type Parameters:
T
-K
-V
-- Parameters:
c
-keyExtractor
-valueExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByV, M extends Map<K, List<V>>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
c
-keyExtractor
-valueExtractor
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <T,K, Map<K,V> List<V>> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) - Type Parameters:
T
-K
-V
-- Parameters:
iter
-keyExtractor
-valueExtractor
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByV, M extends Map<K, List<V>>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
iter
-keyExtractor
-valueExtractor
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <T,K, Map<K,R> R> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) - Type Parameters:
T
-K
-R
-- Parameters:
c
-keyExtractor
-collector
-- Returns:
-
groupBy
@Beta public static <T,K, M groupByR, M extends Map<K, R>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-R
-M
-- Parameters:
c
-keyExtractor
-collector
-mapSupplier
-- Returns:
-
groupBy
@Beta public static <K,T, Map<K,R> R> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) - Type Parameters:
K
-T
-R
-- Parameters:
iter
-keyExtractor
-collector
-- Returns:
-
groupBy
@Beta public static <K,T, M groupByR, M extends Map<K, R>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) - Type Parameters:
K
-T
-R
-M
-- Parameters:
iter
-keyExtractor
-collector
-mapSupplier
-- Returns:
-
countBy
@Beta public static <T,K> Map<K,Integer> countBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
c
-keyExtractor
-- Returns:
-
countBy
@Beta public static <T,K, M countByM extends Map<K, Integer>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-M
-- Parameters:
c
-keyExtractor
-mapSupplier
-- Returns:
-
countBy
@Beta public static <T,K> Map<K,Integer> countBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor) - Type Parameters:
T
-K
-- Parameters:
iter
-keyExtractor
-- Returns:
-
countBy
@Beta public static <T,K, M countByM extends Map<K, Integer>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) - Type Parameters:
T
-K
-M
-- Parameters:
iter
-keyExtractor
-mapSupplier
-- Returns:
-
iterate
Returns an iterator over the elements in the specified array.- Parameters:
a
- the array to iterate over.- Returns:
- an iterator over the elements in the specified array. If the array is
null
, an empty iterator is returned. - See Also:
-
iterate
@Beta public static <T> ObjIterator<T> iterate(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns an iterator over the elements in the specified array, starting from the 'fromIndex' and ending before the 'toIndex'.- Parameters:
a
- the array to iterate over.fromIndex
- the index of the first element to be returned from the iterator.toIndex
- the index after the last element to be returned from the iterator.- Returns:
- an iterator over the elements in the specified range of the array.
- Throws:
IndexOutOfBoundsException
- if the indices are out of range.- See Also:
-
iterate
Returns an iterator over the elements in the specified iterable.- Parameters:
iterable
- theiterable
to iterate over.- Returns:
- an iterator over the elements in the specified iterable. If the
iterable
isnull
, an empty iterator is returned.
-
disjoint
Returnstrue
if the two specified arrays/collections have no elements in common.- Parameters:
a
-b
-- Returns:
-
disjoint
Returnstrue
if the two specified arrays/collections have no elements in common.- Parameters:
c1
-c2
-- Returns:
true
if the two specified arrays have no elements in common.- See Also:
-
toJson
Converts the given object into a JSON string.- Parameters:
obj
- the object to be converted into a JSON string.- Returns:
- a JSON string representation of the given object.
-
toJson
Converts the given object into a JSON string with optional pretty formatting.- Parameters:
obj
- the object to be converted into a JSON string.prettyFormat
- a boolean flag that indicates whether the JSON string should be pretty formatted or not.- Returns:
- a JSON string representation of the given object. If prettyFormat is
true
, the JSON string is formatted with indents and line breaks for easier reading.
-
toJson
- Parameters:
obj
-config
-- Returns:
-
toJson
- Parameters:
obj
-output
-
-
toJson
- Parameters:
obj
-config
-output
-
-
toJson
- Parameters:
obj
-output
-
-
toJson
- Parameters:
obj
-config
-output
-
-
toJson
- Parameters:
obj
-output
-
-
toJson
- Parameters:
obj
-config
-output
-
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
-- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-defaultIfNull
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, JSONDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
-- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(File json, JSONDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
-- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, JSONDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
-- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(Reader json, JSONDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-fromIndex
-toIndex
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-fromIndex
-toIndex
-config
-targetType
-- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, T defaultIfNull, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-defaultIfNull
-targetType
-- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(File json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
- Type Parameters:
T
-- Parameters:
json
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(Reader json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-fromIndex
-toIndex
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
json
-fromIndex
-toIndex
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(String jsonArray, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(String jsonArray, JSONDeserializationConfig config, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.config
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(File jsonArray, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(File jsonArray, JSONDeserializationConfig config, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.config
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(InputStream jsonArray, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.closeInputStreamWhenStreamIsClosed
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.config
-closeInputStreamWhenStreamIsClosed
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(Reader jsonArray, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.closeReaderWhenStreamIsClosed
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
streamJson
public static <T> CheckedStream<T,IOException> streamJson(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementClass) - Type Parameters:
T
-- Parameters:
jsonArray
- must be a json array/list.config
-closeReaderWhenStreamIsClosed
-elementClass
- Only Bean/Map/Collection/Array/DataSet element types are supported at present.- Returns:
-
formatJson
- Parameters:
json
-- Returns:
- See Also:
-
formatJson
- Parameters:
json
-config
-- Returns:
- See Also:
-
formatJson
- Parameters:
json
-transferType
-- Returns:
- See Also:
-
formatJson
- Parameters:
json
-config
-transferType
-- Returns:
- See Also:
-
formatJson
- Parameters:
json
-transferType
-- Returns:
- See Also:
-
formatJson
public static String formatJson(String json, JSONSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) - Parameters:
json
-config
-transferType
-- Returns:
- See Also:
-
toXml
Converts the given object into an XML string.- Parameters:
obj
- the object to be converted into an XML string.- Returns:
- an XML string representation of the given object.
-
toXml
Converts the given object into an XML string with optional pretty formatting.- Parameters:
obj
- the object to be converted into an XML string.prettyFormat
- a boolean flag that indicates whether the XML string should be pretty formatted or not.- Returns:
- an XML string representation of the given object. If prettyFormat is
true
, the XML string is formatted with indents and line breaks for easier reading.
-
toXml
- Parameters:
obj
-config
-- Returns:
-
toXml
- Parameters:
obj
-output
-
-
toXml
- Parameters:
obj
-config
-output
-
-
toXml
- Parameters:
obj
-output
-
-
toXml
- Parameters:
obj
-config
-output
-
-
toXml
- Parameters:
obj
-output
-
-
toXml
- Parameters:
obj
-config
-output
-
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
-- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(String xml, XMLDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
-- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
-- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(File xml, XMLDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
-- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
-- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(InputStream xml, XMLDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
-- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
-- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(Reader xml, XMLDeserializationConfig config, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
-- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(String xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(File xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(InputStream xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
- Type Parameters:
T
-- Parameters:
xml
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
fromXml
public static <T> T fromXml(Reader xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) - Type Parameters:
T
-- Parameters:
xml
-config
-targetType
- can be theType
ofBean/Array/Collection/Map
.- Returns:
- See Also:
-
formatXml
- Parameters:
xml
-- Returns:
- See Also:
-
formatXml
- Parameters:
xml
-config
-- Returns:
- See Also:
-
formatXml
- Parameters:
xml
-transferType
-- Returns:
- See Also:
-
formatXml
- Parameters:
xml
-config
-transferType
-- Returns:
- See Also:
-
formatXml
- Parameters:
xml
-transferType
-- Returns:
- See Also:
-
formatXml
public static String formatXml(String xml, XMLSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) - Parameters:
xml
-config
-transferType
-- Returns:
- See Also:
-
xml2Json
Xml 2 JSO.- Parameters:
xml
-- Returns:
- See Also:
-
xml2Json
Xml 2 JSO.- Parameters:
xml
-transferType
-- Returns:
- See Also:
-
json2Xml
Json 2 XML.- Parameters:
json
-- Returns:
- See Also:
-
json2Xml
Json 2 XML.- Parameters:
json
-transferType
-- Returns:
- See Also:
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, Throwables.Runnable<E> action) throws E Executes the providedaction
for each value in the range defined bystartInclusive
andendExclusive
.- Type Parameters:
E
- the type of the exception that the action may throw- Parameters:
startInclusive
- the start value of the range (inclusive)endExclusive
- the end value of the range (exclusive)action
- the action to be performed for each value in the range- Throws:
E
- if the action throws an exception
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, int step, Throwables.Runnable<E> action) throws IllegalArgumentException, E Executes the providedaction
for each value in the range defined bystartInclusive
,endExclusive
andstep
.- Type Parameters:
E
- the type of the exception that the action may throw- Parameters:
startInclusive
- the start value of the range (inclusive)endExclusive
- the end value of the range (exclusive)step
- the increment value for each iteration in the rangeaction
- the action to be performed for each value in the range- Throws:
IllegalArgumentException
- if the step is less than 1E
- if the action throws an exception
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, Throwables.IntConsumer<E> action) throws E - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-action
-- Throws:
E
- the e
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, int step, Throwables.IntConsumer<E> action) throws E - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-step
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(int startInclusive, int endExclusive, T a, Throwables.IntObjConsumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
startInclusive
-endExclusive
-a
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(int startInclusive, int endExclusive, int step, T a, Throwables.IntObjConsumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
startInclusive
-endExclusive
-step
-a
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(T[] a, Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, E- Type Parameters:
T
-E
-- Parameters:
a
-action
-- Throws:
IndexOutOfBoundsException
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(T[] a, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
a
-fromIndex
-toIndex
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
c
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
iter
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, EMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation. Note: This is NOT a replacement of traditional for loop statement. The traditional for loop is still recommended in regular programming.- Type Parameters:
T
-E
-- Parameters:
c
-fromIndex
-toIndex
-action
-- Throws:
IndexOutOfBoundsException
E
- the e
-
forEach
public static <K,V, void forEachE extends Exception> (Map<K, V> map, Throwables.Consumer<? super Map.Entry<K, throws EV>, E> action) - Type Parameters:
K
-V
-E
-- Parameters:
map
-action
-- Throws:
E
- the e
-
forEach
public static <K,V, void forEachE extends Exception> (Map<K, V> map, Throwables.BiConsumer<? super K, throws E? super V, E> action) - Type Parameters:
K
-V
-E
-- Parameters:
map
-action
-- Throws:
E
- the e
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) - Type Parameters:
T
-E
-- Parameters:
c
-elementConsumer
-processThreadNum
-
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) - Type Parameters:
T
-E
-- Parameters:
c
-elementConsumer
-processThreadNum
-executor
-
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) - Type Parameters:
T
-E
-- Parameters:
iter
-elementConsumer
-processThreadNum
-
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) - Type Parameters:
T
-E
-- Parameters:
iter
-elementConsumer
-processThreadNum
-executor
-
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) - Type Parameters:
T
-U
-E
-E2
-- Parameters:
a
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) - Type Parameters:
T
-U
-E
-E2
-- Parameters:
c
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) - Type Parameters:
T
-U
-E
-E2
-- Parameters:
iter
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) - Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
a
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) - Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
c
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) - Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
iter
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEach
public static <A,B, void forEachE extends Exception> (A[] a, B[] b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachE extends Exception> (Iterable<A> a, Iterable<B> b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachE extends Exception> (Iterator<A> a, Iterator<B> b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (A[] a, B[] b, C[] c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterable<A> a, Iterable<B> b, Iterable<C> c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterator<A> a, Iterator<B> b, Iterator<C> c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachE extends Exception> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachE extends Exception> (Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachE extends Exception> (Iterator<A> a, Iterator<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) - Type Parameters:
A
-B
-E
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-action
-- Throws:
E
- the e
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterator<A> a, Iterator<B> b, Iterator<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) - Type Parameters:
A
-B
-C
-E
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-action
-- Throws:
E
- the e
-
forEachNonNull
public static <T,E extends Exception> void forEachNonNull(T[] a, Throwables.Consumer<? super T, E> action) throws EFor each nonnull
.- Type Parameters:
T
-E
-- Parameters:
a
-action
-- Throws:
E
- the e
-
forEachNonNull
public static <T,E extends Exception> void forEachNonNull(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) throws EFor each nonnull
.- Type Parameters:
T
-E
-- Parameters:
c
-action
-- Throws:
E
- the e
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.- Type Parameters:
T
-U
-E
-E2
-- Parameters:
a
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.- Type Parameters:
T
-U
-E
-E2
-- Parameters:
c
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) For each nonnull
.- Type Parameters:
T
-U
-E
-E2
-- Parameters:
iter
-flatMapper
-action
-- Throws:
E
- the eE2
- the e2
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.- Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
a
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.- Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
c
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) For each nonnull
.- Type Parameters:
T
-T2
-T3
-E
-E2
-E3
-- Parameters:
iter
-flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(T[] a, Throwables.IntObjConsumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
a
-action
-- Throws:
E
- the e
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(T[] a, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, E- Type Parameters:
T
-E
-- Parameters:
a
-fromIndex
-toIndex
-action
-- Throws:
IndexOutOfBoundsException
E
- the e
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
c
-action
-- Throws:
E
- the e
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> action) throws E- Type Parameters:
T
-E
-- Parameters:
iter
-action
-- Throws:
E
- the e
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, EMostly it's designed for one-step operation to complete the operation in one step.java.util.stream.Stream
is preferred for multiple phases operation. Note: This is NOT a replacement of traditional for loop statement. The traditional for loop is still recommended in regular programming.- Type Parameters:
T
-E
-- Parameters:
c
-fromIndex
-toIndex
-action
-- Throws:
IndexOutOfBoundsException
E
- the e
-
forEachIndexed
public static <K,V, void forEachIndexedE extends Exception> (Map<K, V> map, Throwables.IntObjConsumer<? super Map.Entry<K, throws EV>, E> action) - Type Parameters:
K
-V
-E
-- Parameters:
map
-action
-- Throws:
E
- the e
-
forEachIndexed
public static <K,V, void forEachIndexedE extends Exception> (Map<K, V> map, Throwables.IntBiObjConsumer<? super K, throws E? super V, E> action) - Type Parameters:
K
-V
-E
-- Parameters:
map
-action
-- Throws:
E
- the e
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) - Type Parameters:
T
-E
-- Parameters:
c
-elementConsumer
-processThreadNum
-- See Also:
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) - Type Parameters:
T
-E
-- Parameters:
c
-elementConsumer
-processThreadNum
-executor
-- See Also:
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) - Type Parameters:
T
-E
-- Parameters:
iter
-elementConsumer
-processThreadNum
-- See Also:
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) throws IllegalArgumentException- Type Parameters:
T
-E
-- Parameters:
iter
-elementConsumer
-processThreadNum
-executor
-- Throws:
IllegalArgumentException
- See Also:
-
forEachPair
public static <T,E extends Exception> void forEachPair(T[] a, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
a
-action
-- Throws:
E
- the e
-
forEachPair
public static <T,E extends Exception> void forEachPair(T[] a, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
a
-increment
-action
-- Throws:
E
- the e
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterable<? extends T> c, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
c
-action
-- Throws:
E
- the e
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterable<? extends T> c, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
c
-increment
-action
-- Throws:
E
- the e
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterator<? extends T> iter, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
iter
-action
-- Throws:
E
- the e
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterator<? extends T> iter, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) For each pair.- Type Parameters:
T
-E
-- Parameters:
iter
-increment
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(T[] a, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
a
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(T[] a, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
a
-increment
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterable<? extends T> c, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
c
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterable<? extends T> c, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
c
-increment
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterator<? extends T> iter, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
iter
-action
-- Throws:
E
- the e
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterator<? extends T> iter, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) For each triple.- Type Parameters:
T
-E
-- Parameters:
iter
-increment
-action
-- Throws:
E
- the e
-
execute
public static void execute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillis, Predicate<? super Exception> retryCondition) Executes a command with the possibility of retrying in case of failure.- Parameters:
cmd
- The command to be executed. It's a functional interface where the execution logic should be implemented.retryTimes
- The number of times to retry the command execution if it fails.retryIntervallInMillis
- The interval in milliseconds to wait between each retry.retryCondition
- The condition to be checked after each execution failure to decide whether to retry or not.- Throws:
RuntimeException
- if the command execution fails and no more retries are allowed.- See Also:
-
execute
public static <R> R execute(Callable<R> cmd, int retryTimes, long retryIntervallInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes a Callable task with the possibility of retrying in case of failure.- Type Parameters:
R
- The type of the result returned by the Callable task.- Parameters:
cmd
- The Callable task to be executed.retryTimes
- The number of times to retry the task execution if it fails.retryIntervallInMillis
- The interval in milliseconds to wait between each retry.- Returns:
- The result returned by the Callable task.
- Throws:
RuntimeException
- if the task execution fails and no more retries are allowed.- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command) Executes the provided command asynchronously.- Parameters:
command
- The runnable command to be executed asynchronously. It should be an instance of Throwables.Runnable which can throw exceptions.- Returns:
- A ContinuableFuture representing the result of the asynchronous computation. The computation is void, hence the future returns
null
upon completion. - See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, long delayInMillis) Executes the provided command asynchronously after a specified delay.- Parameters:
command
- The runnable command to be executed asynchronously. It should be an instance of Throwables.Runnable which can throw exceptions.delayInMillis
- The delay before the command is executed, in milliseconds.- Returns:
- A ContinuableFuture representing the result of the asynchronous computation. The computation is void, hence the future returns
null
upon completion. - See Also:
-
asyncExecute
public static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands) - Parameters:
commands
-- Returns:
- See Also:
-
asyncExecute
public static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) - Parameters:
commands
-executor
-- Returns:
- See Also:
-
asyncExecute
Executes the provided command asynchronously.- Parameters:
command
- The callable command to be executed asynchronously. It should be an instance of Callable which can return a result and throw exceptions.- Returns:
- A ContinuableFuture representing the result of the asynchronous computation. The computation's result is the return value of the Callable command.
- See Also:
-
asyncExecute
Executes the provided command asynchronously after a specified delay.- Parameters:
command
- The callable command to be executed asynchronously. It should be an instance of Callable which can return a result and throw exceptions.delayInMillis
- The delay before the command is executed, in milliseconds.- Returns:
- A ContinuableFuture representing the result of the asynchronous computation. The computation's result is the return value of the Callable command.
- See Also:
-
asyncExecute
public static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands) - Type Parameters:
R
-- Parameters:
commands
-- Returns:
- See Also:
-
asyncExecute
public static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands, Executor executor) - Type Parameters:
R
-- Parameters:
commands
-executor
-- Returns:
- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillisInMillis, Predicate<? super Exception> retryCondition) Executes a Runnable task asynchronously with the possibility of retrying in case of failure.- Parameters:
cmd
- The Runnable task to be executed. It's a functional interface where the execution logic should be implemented.retryTimes
- The number of times to retry the task execution if it fails.- Returns:
- A ContinuableFuture representing pending completion of the task, and whose
get()
method will returnnull
upon completion. - Throws:
Exception
- if the task execution fails and no more retries are allowed.- See Also:
-
asyncExecute
public static <R> ContinuableFuture<R> asyncExecute(Callable<R> cmd, int retryTimes, long retryIntervallInMillisInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes a Runnable task asynchronously with the possibility of retrying in case of failure.- Parameters:
cmd
- The Runnable task to be executed. It's a functional interface where the execution logic should be implemented.retryTimes
- The number of times to retry the task execution if it fails.retryIntervallInMillisInMillis
- The interval in milliseconds to wait between each retry.retryCondition
- The condition to be met for the task to be retried. It's a functional interface where the condition logic should be implemented.- Returns:
- A ContinuableFuture representing pending completion of the task, and whose
get()
method will returnR
upon completion. - Throws:
Exception
- if the task execution fails and no more retries are allowed.- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, Executor executor) - Parameters:
command
-executor
-- Returns:
- See Also:
-
asyncExecute
- Type Parameters:
R
-- Parameters:
command
-executor
-- Returns:
- See Also:
-
asynRun
public static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If error happens in one command/task, iteration will be interrupted and error will be thrown. But other commands/tasks won't be impacted or cancelled.- Parameters:
commands
-- Returns:
- See Also:
-
asynRun
public static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) throws IllegalArgumentException Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If error happens in one command/task, iteration will be interrupted and error will be thrown. But other commands/tasks won't be impacted or cancelled.- Parameters:
commands
-executor
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
asynCall
Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If error happens in one command/task, iteration will be interrupted and error will be thrown. But other commands/tasks won't be impacted or cancelled.- Type Parameters:
R
-- Parameters:
commands
-- Returns:
- See Also:
-
asynCall
public static <R> ObjIterator<R> asynCall(Collection<? extends Callable<? extends R>> commands, Executor executor) throws IllegalArgumentException Executes the specified commands/tasks asynchronous and immediately returns aniterator
for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If error happens in one command/task, iteration will be interrupted and error will be thrown. But other commands/tasks won't be impacted or cancelled.- Type Parameters:
R
-- Parameters:
commands
-executor
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.command4
- to be completed in another thread.- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4, Throwables.Runnable<? extends Exception> command5) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.command4
- to be completed in another thread.command5
- to be completed in another thread.- See Also:
-
runInParallel
public static void runInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
commands
-
-
runInParallel
public static void runInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) throws IllegalArgumentException Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Parameters:
commands
-executor
-- Throws:
IllegalArgumentException
-
callInParallel
Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-R2
-- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.- Returns:
- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple3<R,R3> R2, callInParallelR3> (Callable<R> command, Callable<R2> command2, Callable<R3> command3) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-R2
-R3
-- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.- Returns:
- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple4<R,R3, R4> R2, callInParallelR3, R4> (Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-R2
-R3
-R4
-- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.command4
- to be completed in another thread.- Returns:
- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple5<R,R3, R4, R5> R2, callInParallelR3, R4, R5> (Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4, Callable<R5> command5) Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-R2
-R3
-R4
-R5
-- Parameters:
command
- to be completed in current thread.command2
- to be completed in another thread.command3
- to be completed in another thread.command4
- to be completed in another thread.command5
- to be completed in another thread.- Returns:
- See Also:
-
callInParallel
Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-- Parameters:
commands
-- Returns:
-
callInParallel
public static <R> List<R> callInParallel(Collection<? extends Callable<? extends R>> commands, Executor executor) throws IllegalArgumentException Executes and complete the input commands in parallel.
if error happens in one task,cancel
will be called for other unfinished tasks.- Type Parameters:
R
-- Parameters:
commands
-executor
-- Returns:
- Throws:
IllegalArgumentException
-
runByBatch
public static <T,E extends Exception> void runByBatch(T[] a, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes a given action on batches of elements from the provided array.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the array.E
- The type of the exception that the action may throw.- Parameters:
a
- The array whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception> void runByBatch(Iterable<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes a given action on batches of elements from the providediterable
.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in theiterable
.E
- The type of the exception that the action may throw.- Parameters:
iter
- The iterable whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception> void runByBatch(Iterator<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes a given action on batches of elements from the provided iterator.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the iterator.E
- The type of the exception that the action may throw.- Parameters:
iter
- The iterator whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes a given action on batches of elements from the provided array.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the array.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
a
- The array whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The action to be executed on each element. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes a given action on batches of elements from the providediterable
.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in theiterable
.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterable whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The action to be executed on each element. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes a given action on batches of elements from the provided iterator.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the iterator.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterator whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The action to be executed on each element. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (T[] a, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes a given function on batches of elements from the provided array.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the array.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the batchAction may throw.- Parameters:
a
- The array whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes a given function on batches of elements from the providediterable
.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in theiterable
.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterable whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes a given function on batches of elements from the provided iterator.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the iterator.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterator whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes a given consumer on batches of elements from the provided array, then executes a batch action after each batch.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the array.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
a
- The array whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The consumer to be executed on each element in the batch. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes a given consumer on each element from the providediterable
in batches, then executes a batch action after each batch.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in theiterable
.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterable whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The consumer to be executed on each element in the batch. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes a given consumer on each element from the provided iterator in batches, then executes a batch action after each batch.
ThebatchAction
must not update or cache the input batch elements.- Type Parameters:
T
- The type of the elements in the iterator.R
- The type of the result returned by the batchAction function.E
- The type of the exception that the elementConsumer may throw.E2
- The type of the exception that the batchAction may throw.- Parameters:
iter
- The iterator whose elements are to be processed.batchSize
- The size of the batches to be processed at a time.elementConsumer
- The consumer to be executed on each element in the batch. It's a functional interface where the execution logic should be implemented.batchAction
- The action to be executed on each batch of elements. ThebatchAction
must not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException
- if the batchSize is not positive or batchAction isnull
.E
- if the elementConsumer throws an exception.E2
- if the batchAction throws an exception.
-
runUninterruptibly
public static void runUninterruptibly(Throwables.Runnable<InterruptedException> cmd) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
cmd
-- Throws:
IllegalArgumentException
-
runUninterruptibly
public static void runUninterruptibly(long timeoutInMillis, Throwables.LongConsumer<InterruptedException> cmd) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeoutInMillis
-cmd
-- Throws:
IllegalArgumentException
-
runUninterruptibly
public static void runUninterruptibly(long timeout, @NotNull TimeUnit unit, @NotNull Throwables.BiConsumer<Long, TimeUnit, throws IllegalArgumentExceptionInterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeout
-unit
-cmd
-- Throws:
IllegalArgumentException
- if the specifiedunit/cmd
isnull
.
-
callUninterruptibly
public static <T> T callUninterruptibly(Throwables.Callable<T, InterruptedException> cmd) throws IllegalArgumentExceptionNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T
-- Parameters:
cmd
-- Returns:
- Throws:
IllegalArgumentException
-
callUninterruptibly
public static <T> T callUninterruptibly(long timeoutInMillis, Throwables.LongFunction<? extends T, InterruptedException> cmd) throws IllegalArgumentExceptionNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T
-- Parameters:
timeoutInMillis
-cmd
-- Returns:
- Throws:
IllegalArgumentException
-
callUninterruptibly
public static <T> T callUninterruptibly(long timeout, @NotNull TimeUnit unit, @NotNull Throwables.BiFunction<Long, TimeUnit, throws IllegalArgumentExceptionT, InterruptedException> cmd) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T
-- Parameters:
timeout
-unit
-cmd
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedunit/cmd
isnull
.
-
sleep
public static void sleep(long timeoutInMillis) Pauses the execution of the current thread for a specified time.- Parameters:
timeoutInMillis
- The time, in milliseconds, to pause the thread.
-
sleep
Pauses the execution of the current thread for a specified time.- Parameters:
timeout
- The time to pause the thread. The unit of time is determined by the 'unit' parameter.unit
- The unit of time for the 'timeout' parameter. This should be a valid TimeUnit enumeration value.- Throws:
IllegalArgumentException
- if the specifiedunit
isnull
.
-
sleepUninterruptibly
public static void sleepUninterruptibly(long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeoutInMillis
-
-
sleepUninterruptibly
public static void sleepUninterruptibly(long timeout, @NotNull TimeUnit unit) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeout
-unit
-- Throws:
IllegalArgumentException
- if the specifiedunit
isnull
.
-
tryOrEmptyIfExceptionOccurred
Returns aNullable
with the value returned byaction
or an emptyNullable
if exception happens.- Type Parameters:
R
-- Parameters:
cmd
-- Returns:
- See Also:
-
tryOrEmptyIfExceptionOccurred
@Beta public static <T,R> u.Nullable<R> tryOrEmptyIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func) Returns aNullable
with the value returned byfunc.apply(init)
or an emptyNullable
if exception happens.- Type Parameters:
T
-R
-- Parameters:
init
-func
-- Returns:
- See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <R> R tryOrDefaultIfExceptionOccurred(Callable<R> cmd, R defaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.- Type Parameters:
R
-- Parameters:
cmd
-defaultIfExceptionOccurred
-- Returns:
- See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, R defaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.- Type Parameters:
T
-R
-- Parameters:
init
-func
-defaultIfExceptionOccurred
-- Returns:
- See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <R> R tryOrDefaultIfExceptionOccurred(Callable<R> cmd, Supplier<R> supplierForDefaultIfExceptionOccurred) Returns the value returned byaction
or{@code supplierForDefaultIfExceptionOccurred}
if exception happens.- Type Parameters:
R
-- Parameters:
cmd
-supplierForDefaultIfExceptionOccurred
-- Returns:
- See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, Supplier<R> supplierForDefaultIfExceptionOccurred) Returns the value returned byaction
ordefaultIfExceptionOccurred
if exception happens.- Type Parameters:
T
-R
-- Parameters:
init
-func
-supplierForDefaultIfExceptionOccurred
-- Returns:
- See Also:
-
ifOrEmpty
@Beta public static <R,E extends Exception> u.Nullable<R> ifOrEmpty(boolean b, Throwables.Supplier<R, E> supplier) throws EReturns aNullable
with value got from the specifiedsupplier
if b istrue
, otherwise returns an emptyNullable
if b isfalse
.- Type Parameters:
R
-E
-- Parameters:
b
-supplier
-- Returns:
- Throws:
E
- the e
-
ifOrElse
@Beta public static <E1 extends Exception,E2 extends Exception> void ifOrElse(boolean b, Throwables.Runnable<E1> actionForTrue, Throwables.Runnable<E2> actionForFalse) throws E1, E2 Executes the provided actions based on the boolean condition.- Type Parameters:
E1
- The type of exception that the first action may throw.E2
- The type of exception that the second action may throw.- Parameters:
b
- The boolean condition to test.actionForTrue
- The action to be executed if the condition istrue
.actionForFalse
- The action to be executed if the condition isfalse
.- Throws:
E1
- if the condition istrue
and the execution of actionForTrue throws this exception.E2
- if the condition isfalse
and the execution of actionForFalse throws this exception.
-
ifNotNull
@Beta public static <T,E extends Exception> void ifNotNull(T obj, Throwables.Consumer<? super T, E> cmd) throws E- Throws:
E
-
ifNotEmpty
@Beta public static <C extends CharSequence,E extends Exception> void ifNotEmpty(C c, Throwables.Consumer<? super C, E> cmd) throws EExecutes the provided action if the givenCharSequence
is not empty.- Type Parameters:
C
- The type of theCharSequence
.E
- The type of exception that the action may throw.- Parameters:
c
- TheCharSequence
to be tested for emptiness.cmd
- The action to be executed if theCharSequence
is not empty.- Throws:
E
- if the execution of the action throws this exception.
-
ifNotEmpty
@Beta public static <C extends Collection,E extends Exception> void ifNotEmpty(C c, Throwables.Consumer<? super C, E> cmd) throws EExecutes the provided action if the given collection is not empty.- Type Parameters:
C
- The type of the collection.E
- The type of exception that the action may throw.- Parameters:
c
- The collection to be tested for emptiness.cmd
- The action to be executed if the collection is not empty.- Throws:
E
- if the execution of the action throws this exception.
-
ifNotEmpty
@Beta public static <M extends Map,E extends Exception> void ifNotEmpty(M m, Throwables.Consumer<? super M, E> cmd) throws EExecutes the provided action if the given map is not empty.- Type Parameters:
M
- The type of the map.E
- The type of exception that the action may throw.- Parameters:
m
- The map to be tested for emptiness.cmd
- The action to be executed if the map is not empty.- Throws:
E
- if the execution of the action throws this exception.
-
applyToEach
@Beta public static <T,E extends Exception> void applyToEach(T[] a, Throwables.Function<? super T, ? extends T, throws IllegalArgumentException, EE> converter) Updates each element in the specified array with specified functionconverter
.- Type Parameters:
T
-E
-- Parameters:
a
-converter
-- Throws:
IllegalArgumentException
E
-
applyToEach
@Beta public static <T,E extends Exception> void applyToEach(List<T> c, Throwables.Function<? super T, ? extends T, throws IllegalArgumentException, EE> converter) Updates each element in the specified List with specified functionconverter
.- Type Parameters:
T
-E
-- Parameters:
c
-converter
-- Throws:
IllegalArgumentException
E
-
copyThenApplyToEach
@MayReturnNull public static <T,E extends Exception> T[] copyThenApplyToEach(T[] a, Throwables.Function<? super T, ? extends T, throws EE> converter) Copies the specified array first, then applies the provided converter function to each element of the copy.- Type Parameters:
T
- the type of elements in the arrayE
- the type of exception that the converter function may throw- Parameters:
a
- the array to be copied and processedconverter
- the function to apply to each element of the copied array- Returns:
- a new array with the converted elements, or
nulll
if the specified array isnull
- Throws:
E
- if the converter function throws an exception
-
lazyInit
Creates a lazy-initialized supplier from the provided supplier. The supplier's get() method will not be called until necessary and only be called only because the returned value will be cached.- Type Parameters:
T
- The type of results supplied by this supplier- Parameters:
supplier
- The supplier to be lazily initialized- Returns:
- A lazy-initialized supplier
-
lazyInitialize
@Beta public static <T,E extends Exception> Throwables.Supplier<T,E> lazyInitialize(Throwables.Supplier<T, E> supplier) Creates a lazy-initialized supplier from the provided supplier. The supplier's get() method will not be called until necessary and only be called only because the returned value will be cached.- Type Parameters:
T
- The type of results supplied by this supplier- Parameters:
supplier
- The supplier to be lazily initialized- Returns:
- A lazy-initialized supplier
-
toRuntimeException
Converts the provided exception to a runtime exception.- Parameters:
e
- The exception to be converted to a runtime exception.- Returns:
- A RuntimeException that represents the provided exception.
- See Also:
-
toRuntimeException
Converts the specifiedThrowable
to aRuntimeException
if it's a checkedexception
or anError
, otherwise returns itself.- Parameters:
e
-- Returns:
- See Also:
-
toRuntimeException
Converts the specifiedThrowable
to aRuntimeException
if it's a checkedexception
, or throw it if it's anError
. Otherwise returns itself.- Parameters:
e
-throwIfItIsError
-- Returns:
- See Also:
-
println
public static <T> T println(T obj) Prints the given object to the standard output stream (System.out) and returns the object. The object's string representation is obtained by callingN.toString(Object)
method.- Type Parameters:
T
- The type of the object to be printed.- Parameters:
obj
- The object to be printed.- Returns:
- The same object that was printed.
-
fprintln
Prints a formatted string and an array of arguments, following the syntax rules ofString.format(String, Object...)
. The result string is then printed to the standard output stream (System.out) and returned as an array of the provided arguments.- Type Parameters:
T
- The type of the arguments.- Parameters:
format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string.- Returns:
- The same array of arguments that was printed.
-
typeOf
public static <T> com.landawn.abacus.type.Type<T> typeOf(@NotNull String typeName) throws IllegalArgumentException Gets a Type by the given type name.- Parameters:
typeName
- the name of the type to be retrieved.- Returns:
- the Type corresponding to the given type name.
- Throws:
IllegalArgumentException
- if the specifiedtypeName
isnull
.
-
typeOf
public static <T> com.landawn.abacus.type.Type<T> typeOf(@NotNull Class<?> cls) throws IllegalArgumentException Gets a Type by the givenClass
.- Parameters:
typeName
- the name of the type to be retrieved.- Returns:
- the Type corresponding to the given type name.
- Throws:
IllegalArgumentException
- if the specifiedClass
isnull
.
-
defaultValueOf
Returns the default value of the given class type.- Type Parameters:
T
-- Parameters:
cls
- the class type for which the default value is to be returned.- Returns:
- the default value of the given class type. For example, for an Integer class type, it will return 0.
- Throws:
IllegalArgumentException
- if the specified class type isnull
.
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
c
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
c
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Parameters:
b
-defaultForNull
-- Returns:
-
defaultIfNull
public static <T> T defaultIfNull(T obj, T defaultForNull) Returns the specified default value if the specified object isnull
or itself if the specified object is notnull
.- Type Parameters:
T
-- Parameters:
obj
-defaultForNull
-- Returns:
-
defaultIfNull
Returns the default value provided by specifiedSupplier
if the specified object isnull
or itself if the specified object is notnull
.- Type Parameters:
T
-- Parameters:
obj
-supplierForDefault
-- Returns:
-
defaultIfEmpty
Returns the specified default value if the specified object is empty or itself if the specified object is not empty.- Type Parameters:
T
-- Parameters:
str
-defaultStr
-- Returns:
- See Also:
-
defaultIfEmpty
public static <T extends CharSequence> T defaultIfEmpty(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplier
if the specified object is empty or itself if the specified object is not empty.- Type Parameters:
T
-- Parameters:
str
-getterForDefaultStr
-- Returns:
- See Also:
-
defaultIfBlank
Returns the specified default value if the specified object is blank or itself if the specified object is not blank.- Type Parameters:
T
-- Parameters:
str
-defaultStr
-- Returns:
- See Also:
-
defaultIfBlank
public static <T extends CharSequence> T defaultIfBlank(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplier
if the specified object is blank or itself if the specified object is not blank.- Type Parameters:
T
-- Parameters:
str
-getterForDefaultStr
-- Returns:
- See Also:
-
defaultIfEmpty
Returns the specified default value if the specified Collection/Map is empty or itself if the specified object is not empty.- Type Parameters:
T
-- Parameters:
c
-defaultColl
-- Returns:
-
defaultIfEmpty
Returns the specified default value if the specified Collection/Map is empty or itself if the specified object is not empty.- Type Parameters:
T
-- Parameters:
m
-defaultMap
-- Returns:
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value. Returns "true" if the value is
true
, "false" otherwise.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val
- the value to be converted.- Returns:
- the String representation of the given value.
null
if the specified object is null
-
valueOf
Converts the given string to its corresponding value of the specified target type.- Type Parameters:
T
- The type of the target object after conversion.- Parameters:
str
- The string to be converted.targetType
- The class of the target type to which the string is to be converted.- Returns:
- The converted value of the specified target type. If the input string is
null
, it returns the default value of the target type. - Throws:
IllegalArgumentException
- if the specified target type isnull
.
-
registerConverter
public static boolean registerConverter(@NotNull Class<?> srcClass, BiFunction<?, Class<?>, throws IllegalArgumentException?> converter) Registers a converter for a specific source class. The converter is a function that takes an object of the source class and a target class, and converts the source object into an instance of the target class.- Type Parameters:
T
- The type of the source object to be converted.R
- The type of the target object after conversion.- Parameters:
srcClass
- The source class that the converter can convert from. This must not be a built-in class.converter
- The converter function that takes a source object and a target class, and returns an instance of the target class.- Returns:
true
if there is noconverter
registered with specifiedsrcClass
yet before this call.- Throws:
IllegalArgumentException
- if the specifiedsrcClass
is a built-in class or if eithersrcClass
orconverter
isnull
.
-
convert
public static <T> T convert(Object srcObj, Class<? extends T> targetType) throws IllegalArgumentException, NumberFormatException, RuntimeException Converts the given source object to the specified target type. If the source object isnull
, the default value of the target type is returned. If the source object can be converted to the target type, an instance of the target type is returned.- Type Parameters:
T
- The type of the target object after conversion.- Parameters:
srcObj
- The source object to be converted. Ifnull
, the default value of the target type is returned.targetType
- The class of the target type to which the source object is to be converted.- Returns:
- An instance of the target type converted from the source object, or the default value of the target type if the source object is
null
. - Throws:
IllegalArgumentException
- if the source object cannot be converted to the target type.NumberFormatException
- if string value of the source object cannot be parsed to the target(Number) type.RuntimeException
- if any other error occurs during the conversion.
-
convert
public static <T> T convert(Object srcObj, com.landawn.abacus.type.Type<? extends T> targetType) throws IllegalArgumentException, NumberFormatException, RuntimeException Converts the given source object to the specified target type using the provided Type instance. If the source object isnull
, the default value of the target type is returned. If the source object can be converted to the target type, an instance of the target type is returned.- Type Parameters:
T
- The type of the target object after conversion.- Parameters:
srcObj
- The source object to be converted.targetType
- The Type instance of the target type to which the source object is to be converted.- Returns:
- An instance of the target type converted from the source object, or the default value of the target type if the source object is
null
. - Throws:
IllegalArgumentException
- if the source object cannot be converted to the target type.NumberFormatException
- if string value of the source object cannot be parsed to the target(Number) type.RuntimeException
- if any other error occurs during the conversion.
-
castIfAssignable
Casts the given object to the specified target type if possible. If the object isnull
or cannot be assigned to the target type, an emptyNullable
is returned. Note thatnull
can be assigned to any Object type except primitive types: boolean/char/byte/short/int/long/double.- Type Parameters:
T
- The type of the target object after casting.- Parameters:
val
- The object to be casted.targetType
- The class of the target type to which the object is to be casted.- Returns:
- A
Nullable
containing the casted object if the casting is successful, or an emptyNullable
if the object isnull
or cannot be casted to the target type.
-
castIfAssignable
@Beta public static <T> u.Nullable<T> castIfAssignable(Object val, com.landawn.abacus.type.Type<? extends T> targetType) Casts the given object to the specified target type if possible using the provided Type instance. If the object isnull
or cannot be assigned to the target type, an emptyNullable
is returned. Note thatnull
can be assigned to any Object type except primitive types: boolean/char/byte/short/int/long/double.- Type Parameters:
T
- The type of the target object after casting.- Parameters:
val
- The object to be casted.targetType
- The Type instance of the target type to which the object is to be casted.- Returns:
- A
Nullable
containing the casted object if the casting is successful, or an emptyNullable
if the object isnull
or cannot be casted to the target type.
-
getPropNames
Retrieves the property names of the given bean class.- Parameters:
beanClass
- the class of the bean whose property names are to be retrieved.- Returns:
- an ImmutableList of strings representing the property names of the given bean class.
- Throws:
IllegalArgumentException
- if the specified bean class isnull
.
-
getPropNames
Retrieves the property names of the given bean class excluding the specified property names.- Parameters:
beanClass
- the class of the bean whose property names are to be retrieved.propNameToExclude
- a set of property names to be excluded from the returned list.- Returns:
- a List of strings representing the property names of the given bean class excluding the specified property names.
- Throws:
IllegalArgumentException
- if the specified bean class isnull
.- See Also:
-
getPropNames
Retrieves the property names of the given bean object.- Parameters:
bean
- The bean object whose property names are to be retrieved.- Returns:
- A list of strings representing the property names of the given bean object.
- Throws:
IllegalArgumentException
- if the specified bean object isnull
.- See Also:
-
getPropNames
Retrieves the property names of the given bean object.- Parameters:
bean
- The bean object whose property names are to be retrieved.ignoreNullValue
- Iftrue
, the method will ignore property names withnull
values.- Returns:
- A list of strings representing the property names of the given bean object. If
ignoreNullValue
istrue
, properties withnull
values are not included in the list. - Throws:
IllegalArgumentException
- if the specified bean object isnull
.- See Also:
-
getPropValue
Retrieves the value of the specified property from the given bean object.- Type Parameters:
T
- The type of the property value.- Parameters:
bean
- The bean object from which the property value is to be retrieved.propName
- The name of the property whose value is to be retrieved.- Returns:
- The value of the specified property of the given bean object.
- Throws:
IllegalArgumentException
- if the specified bean object isnull
.- See Also:
-
getPropValue
Retrieves the value of the specified property from the given bean object.- Type Parameters:
T
- The type of the property value.- Parameters:
bean
- The bean object from which the property value is to be retrieved.propName
- The name of the property whose value is to be retrieved.ignoreUnmatchedProperty
- Iftrue
, the method will not throw an exception if the property does not exist in the bean object.- Returns:
- The value of the specified property of the given bean object.
- Throws:
IllegalArgumentException
- if the specified bean object isnull
or if the property does not exist and ignoreUnmatchedProperty isfalse
.- See Also:
-
setPropValue
Deprecated.Sets the value of the specified property in the given bean object.
Refer to setPropValue(Method, Object, Object).- Parameters:
bean
- The bean object in which the property value is to be set.propName
- The name of the property whose value is to be set. The property name is case insensitive.propValue
- The new value to be set for the specified property in the given bean object.- Throws:
IllegalArgumentException
- if the specified bean object isnull
.- See Also:
-
clone
Clones the given object. The object must be serializable and deserializable throughKryo
orJSON
.- Type Parameters:
T
-- Parameters:
obj
- a Java object which must be serializable and deserializable throughKryo
orJSON
.- Returns:
null
ifbean
isnull
-
clone
public static <T> T clone(Object obj, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Deeply copy by: obj -> serialize -> kryo/Json -> deserialize -> new object.- Type Parameters:
T
-- Parameters:
obj
- a Java object which must be serializable and deserialiable throughKryo
orJSON
.targetType
-- Returns:
- a new instance of
targetType
even ifbean
isnull
. - Throws:
IllegalArgumentException
- iftargetType
isnull
.
-
copy
Returns a copy of the given source bean.- Type Parameters:
T
- the type of the source bean- Parameters:
sourceBean
- the source bean to copy- Returns:
- a new instance of the same class with the same properties copied from the source bean, or
null
if the source bean isnull
-
copy
Returns a copy of the given source bean with selected properties.- Type Parameters:
T
- the type of the source bean- Parameters:
sourceBean
- the source bean to copyselectPropNames
- the collection of property names to be copied- Returns:
- a new instance of the same class with the selected properties copied from the source bean, or
null
if the source bean isnull
-
copy
Returns a copy of the given source bean with properties filtered by the specified predicate.- Type Parameters:
T
- the type of the source bean- Parameters:
sourceBean
- the source bean to copypropFilter
- the predicate to filter properties to be copied- Returns:
- a new instance of the same class with the filtered properties copied from the source bean, or
null
if the source bean isnull
-
copy
public static <T> T copy(Object sourceBean, Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetType
with properties copied from the given source bean.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copytargetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- if the specifiedtargetType
isnull
-
copy
public static <T> T copy(Object sourceBean, Collection<String> selectPropNames, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetType
with properties copied from the given source bean with selected properties.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copyselectPropNames
- the collection of property names to be copiedtargetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- if the specifiedtargetType
isnull
-
copy
public static <T> T copy(Object sourceBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, @NotNull Class<? extends T> targetType) throws IllegalArgumentExceptionReturns a new instance of specifiedtargetType
with properties copied from the given source bean with selected properties.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copyselectPropNames
- the collection of property names to be copiedpropNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.targetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- if the specifiedtargetType
isnull
-
copy
public static <T> T copy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Class<? extends T> targetType) throws IllegalArgumentExceptionReturns a new instance of specifiedtargetType
with properties copied from the given source bean, filtered by the specified predicate.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copypropFilter
- A BiPredicate used to filter the properties to be copied. The predicate takes a property name and its value, and returnstrue
if the property should be copied.targetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
copy
public static <T> T copy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetType
with properties copied from the given source bean, filtered by the specified predicate.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copypropFilter
- A BiPredicate used to filter the properties to be copied. The predicate takes a property name and its value, and returnstrue
if the property should be copied.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.targetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
copy
public static <T> T copy(Object sourceBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetType
with properties copied from the given source bean, except the properties specified in theignoredPropNames
set.- Type Parameters:
T
- the type of the target bean- Parameters:
sourceBean
- the source bean to copyignoreUnmatchedProperty
- iftrue
, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames
- the set of property names to be ignored during copyingtargetType
- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null
- Throws:
IllegalArgumentException
- if the specifiedtargetType
isnull
-
merge
Merges the properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames) throws IllegalArgumentException Merges the selected properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames
- The collection of property names to be merged.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the selected properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames
- The collection of property names to be merged.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter) throws IllegalArgumentExceptionMerges the selected properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames
- The collection of property names to be merged.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the selected properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames
- The collection of property names to be merged.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter) throws IllegalArgumentExceptionMerges the filtered properties from the source object into the target object, The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.propFilter
- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrue
if the property should be merged.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object after merging.- Parameters:
sourceBean
- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean
- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter
- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrue
if the property should be merged.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- if targetBean isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter) Merges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object after merging.- Parameters:
sourceBean
- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean
- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter
- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrue
if the property should be merged.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- if targetBean isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object after merging.- Parameters:
sourceBean
- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean
- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter
- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrue
if the property should be merged.propNameConverter
- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- if targetBean isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames) throws IllegalArgumentException Merges the properties from the source object into the target object, except the properties specified in theignoredPropNames
set. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.ignoreUnmatchedProperty
- iftrue
, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames
- The set of property names to be ignored during merging.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the properties from the source object into the target object using the specified merge function, except the properties specified in theignoredPropNames
set. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T
- The type of the target object.- Parameters:
sourceBean
- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean
- The target object into which properties are to be copied. This object should allow access to properties using setter methods.ignoreUnmatchedProperty
- iftrue
, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames
- The set of property names to be ignored during merging.mergeFunc
- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException
- iftargetBean
isnull
.
-
erase
Erases the properties of the given bean object. This method sets the properties specified by the property names to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse
, and object properties are set tonull
.- Parameters:
bean
- The bean object whose properties are to be erased. If this isnull
, the method does nothing.propNames
- The names of the properties to be erased. These should correspond to the getter/setter methods in the bean object. If this is empty, the method does nothing.
-
erase
Erases the properties of the given bean object. This method sets the properties specified by the property names to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse
, and object properties are set tonull
.- Parameters:
bean
- The bean object whose properties are to be erased. If this isnull
, the method does nothing.propNames
- The names of the properties to be erased. These should correspond to the getter/setter methods in the bean object. If this is empty, the method does nothing.
-
eraseAll
Erases all the properties of the given bean object. This method sets all properties of the bean object to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse
, and object properties are set tonull
.- Parameters:
bean
- The bean object whose properties are to be erased. If this isnull
, the method does nothing.
-
enumListOf
Returns an immutable/unmodifiable list of all the enum constants in the specified enum class. This method retrieves all the enum constants defined in the given enum class and returns them as an ImmutableList. The order of the constants in the list is the order in which they're declared in the enum class.- Type Parameters:
E
- The type of the enum constants. This should be an enum type.- Parameters:
enumClass
- The class object of the enum type whose constants are to be listed. Must not benull
.- Returns:
- An ImmutableList containing all the enum constants in the order they're declared in the enum class.
-
enumSetOf
Returns an immutable/unmodifiable set of all the enum constants in the specified enum class. This method retrieves all the enum constants defined in the given enum class and returns them as an ImmutableSet. The order of the constants in the set is the order in which they're declared in the enum class.- Type Parameters:
E
- The type of the enum constants. This should be an enum type.- Parameters:
enumClass
- The class object of the enum type whose constants are to be listed. Must not benull
.- Returns:
- An ImmutableSet containing all the enum constants in the order they're declared in the enum class.
-
enumMapOf
Returns an immutable/unmodifiable bi-directional map of all the enum constants in the specified enum class to their names. This method retrieves all the enum constants defined in the given enum class and maps them to their names as an ImmutableBiMap. The order of the constants in the map is the order in which they're declared in the enum class.- Type Parameters:
E
- The type of the enum constants. This should be an enum type.- Parameters:
enumClass
- The class object of the enum type whose constants are to be listed. Must not benull
.- Returns:
- An ImmutableBiMap where each key-value pair corresponds to an enum constant and its name.
-
newInstance
- Type Parameters:
T
-- Parameters:
cls
-- Returns:
- T
- See Also:
-
newProxyInstance
Creates a new proxy instance for the specified interface using the provided invocation handler. This method is a utility for creating dynamic proxies. A dynamic proxy class is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create an object that can implement an arbitrary set of interfaces specified at runtime.- Type Parameters:
T
- The type of the interface for the proxy class to implement.- Parameters:
interfaceClass
- The Class object of the interface for the proxy class to implement. Must not benull
.h
- The invocation handler to dispatch method invocations to. It's a object that implements the InvocationHandler interface.- Returns:
- a proxy instance that implements the specified interface(s) and dispatches method invocations to the specified invocation handler.
- See Also:
-
newProxyInstance
Creates a new proxy instance for the specified interfaces using the provided invocation handler. This method is a utility for creating dynamic proxies. A dynamic proxy class is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create an object that can implement an arbitrary set of interfaces specified at runtime.- Type Parameters:
T
- The type of the interface for the proxy class to implement.- Parameters:
interfaceClasses
- The array of Class objects of the interfaces for the proxy class to implement. Must not benull
.h
- The invocation handler to dispatch method invocations to. It's an object that implements the InvocationHandler interface.- Returns:
- a proxy instance that implements the specified interface(s) and dispatches method invocations to the specified invocation handler.
- See Also:
-
newCollection
- Type Parameters:
T
-- Parameters:
targetType
-- Returns:
- See Also:
-
newCollection
- Type Parameters:
T
-- Parameters:
targetType
-size
-- Returns:
- See Also:
-
newMap
- Type Parameters:
K
-V
-- Parameters:
targetType
-- Returns:
- See Also:
-
newMap
- Type Parameters:
K
-V
-- Parameters:
targetType
-size
-- Returns:
- See Also:
-
newArray
- Type Parameters:
T
-- Parameters:
componentType
-length
-- Returns:
- T[]
- See Also:
-
newArray
@SafeVarargs public static <T> T newArray(Class<?> componentType, int... dimensions) throws IllegalArgumentException, NegativeArraySizeException - Type Parameters:
T
-- Parameters:
componentType
-dimensions
-- Returns:
- Throws:
IllegalArgumentException
NegativeArraySizeException
- See Also:
-
newBean
- Type Parameters:
T
-- Parameters:
targetType
-- Returns:
-
newBean
- Type Parameters:
T
-- Parameters:
targetType
-beanName
-- Returns:
-
newArrayList
New array list.- Type Parameters:
T
-- Returns:
-
newArrayList
New array list.- Type Parameters:
T
-- Parameters:
initialCapacity
-- Returns:
-
newArrayList
New array list.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newLinkedList
New linked list.- Type Parameters:
T
-- Returns:
-
newLinkedList
New linked list.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newHashSet
New hash set.- Type Parameters:
T
-- Returns:
-
newHashSet
New hash set.- Type Parameters:
T
-- Parameters:
initialCapacity
-- Returns:
-
newHashSet
New hash set.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newLinkedHashSet
New linked hash set.- Type Parameters:
T
-- Returns:
-
newLinkedHashSet
New linked hash set.- Type Parameters:
T
-- Parameters:
initialCapacity
-- Returns:
-
newLinkedHashSet
New linked hash set.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newTreeSet
New tree set.- Type Parameters:
T
-- Returns:
-
newTreeSet
New tree set.- Type Parameters:
T
-- Parameters:
comparator
-- Returns:
-
newTreeSet
New tree set.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newTreeSet
New tree set.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newConcurrentHashSet
New hash set.- Type Parameters:
T
-- Returns:
- See Also:
-
newConcurrentHashSet
New hash set.- Type Parameters:
T
-- Parameters:
initialCapacity
-- Returns:
- See Also:
-
newConcurrentHashSet
New hash set.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- See Also:
-
newSetFromMap
Returns a set backed by the specified map.- Type Parameters:
E
-- Parameters:
map
- the backing map- Returns:
- See Also:
-
newMultiset
- Type Parameters:
T
-- Returns:
-
newMultiset
- Type Parameters:
T
-- Parameters:
initialCapacity
-- Returns:
-
newMultiset
- Type Parameters:
T
-- Parameters:
valueMapType
-- Returns:
-
newMultiset
- Type Parameters:
T
-- Parameters:
mapSupplier
-- Returns:
-
newMultiset
- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
newArrayDeque
New array deque.- Type Parameters:
T
-- Returns:
-
newArrayDeque
Constructs an empty array deque with an initial capacity sufficient to hold the specified number of elements.- Type Parameters:
T
-- Parameters:
numElements
- lower bound on initial capacity of the deque.- Returns:
-
newArrayDeque
Constructs a deque containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Type Parameters:
E
-- Parameters:
c
-- Returns:
-
newEntry
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
key
-value
-- Returns:
-
newImmutableEntry
New immutable/unmodifiable entry.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
key
-value
-- Returns:
-
newHashMap
New hash map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newHashMap
New hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-- Returns:
-
newHashMap
New hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newHashMap
public static <K,V> Map<K,V> newHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyMapper) throws IllegalArgumentExceptionNew hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
c
-keyMapper
-- Returns:
- Throws:
IllegalArgumentException
-
newLinkedHashMap
New linked hash map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newLinkedHashMap
New linked hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-- Returns:
-
newLinkedHashMap
New linked hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newLinkedHashMap
public static <K,V> Map<K,V> newLinkedHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyMapper) throws IllegalArgumentExceptionNew linked hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
c
-keyMapper
-- Returns:
- Throws:
IllegalArgumentException
-
newTreeMap
New tree map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newTreeMap
New tree map.- Type Parameters:
C
-K
- the key typeV
- the value type- Parameters:
comparator
-- Returns:
-
newTreeMap
public static <K extends Comparable<? super K>,V> TreeMap<K,V> newTreeMap(Map<? extends K, ? extends V> m) New tree map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newTreeMap
New tree map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newIdentityHashMap
New identity hash map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newIdentityHashMap
New identity hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-- Returns:
-
newIdentityHashMap
New identity hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newConcurrentHashMap
New concurrent hash map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newConcurrentHashMap
New concurrent hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-- Returns:
-
newConcurrentHashMap
New concurrent hash map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
m
-- Returns:
-
newBiMap
New bi map.- Type Parameters:
K
- the key typeV
- the value type- Returns:
-
newBiMap
New bi map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-- Returns:
-
newBiMap
New bi map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
initialCapacity
-loadFactor
-- Returns:
-
newBiMap
public static <K,V> BiMap<K,V> newBiMap(Class<? extends Map> keyMapType, Class<? extends Map> valueMapType) New bi map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapType
-valueMapType
-- Returns:
-
newBiMap
public static <K,V> BiMap<K,V> newBiMap(Supplier<? extends Map<K, V>> keyMapSupplier, Supplier<? extends Map<V, K>> valueMapSupplier) New bi map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapSupplier
-valueMapSupplier
-- Returns:
-
newMultimap
public static <K,E, Multimap<K,V extends Collection<E>> E, newMultimapV> (Supplier<? extends Map<K, V>> mapSupplier, Supplier<? extends V> valueSupplier) - Type Parameters:
K
- the key typeE
-V
- the value type- Parameters:
mapSupplier
-valueSupplier
-- Returns:
-
newListMultimap
New list multimap.- Type Parameters:
K
- the key typeE
-- Returns:
-
newListMultimap
New list multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
initialCapacity
-- Returns:
-
newListMultimap
New list multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapType
-- Returns:
-
newListMultimap
public static <K,E> ListMultimap<K,E> newListMultimap(Class<? extends Map> mapType, Class<? extends List> valueType) New list multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapType
-valueType
-- Returns:
-
newListMultimap
public static <K,E> ListMultimap<K,E> newListMultimap(Supplier<? extends Map<K, List<E>>> mapSupplier, Supplier<? extends List<E>> valueSupplier) New list multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapSupplier
-valueSupplier
-- Returns:
-
newListMultimap
New list multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newListMultimap
public static <T,K> ListMultimap<K,T> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) - Type Parameters:
T
-K
- the key type- Parameters:
c
-keyMapper
-- Returns:
-
newListMultimap
public static <T,K, ListMultimap<K,E> E> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends E> valueExtractor) - Type Parameters:
T
-K
- the key typeE
-- Parameters:
c
-keyMapper
-valueExtractor
-- Returns:
-
newLinkedListMultimap
Returns aListMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Returns:
-
newLinkedListMultimap
Returns aListMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
initialCapacity
-- Returns:
-
newLinkedListMultimap
Returns aListMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newSortedListMultimap
Returns aListMultimap
backed bySortedMap
.'Sorted'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Returns:
-
newSortedListMultimap
public static <K extends Comparable<? super K>,E> ListMultimap<K,E> newSortedListMultimap(Map<? extends K, ? extends E> m) Returns aListMultimap
backed bySortedMap
.'Sorted'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newSetMultimap
New set multimap.- Type Parameters:
K
- the key typeE
-- Returns:
-
newSetMultimap
New set multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
initialCapacity
-- Returns:
-
newSetMultimap
New set multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapType
-- Returns:
-
newSetMultimap
public static <K,E> SetMultimap<K,E> newSetMultimap(Class<? extends Map> mapType, Class<? extends Set> valueType) New set multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapType
-valueType
-- Returns:
-
newSetMultimap
public static <K,E> SetMultimap<K,E> newSetMultimap(Supplier<? extends Map<K, Set<E>>> mapSupplier, Supplier<? extends Set<E>> valueSupplier) New set multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
mapSupplier
-valueSupplier
-- Returns:
-
newSetMultimap
New set multimap.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newSetMultimap
public static <T,K> SetMultimap<K,T> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) - Type Parameters:
T
-K
- the key type- Parameters:
c
-keyMapper
-- Returns:
-
newSetMultimap
public static <T,K, SetMultimap<K,E> E> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends E> valueExtractor) - Type Parameters:
T
-K
- the key typeE
-- Parameters:
c
-keyMapper
-valueExtractor
-- Returns:
-
newLinkedSetMultimap
Returns aSetMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Returns:
-
newLinkedSetMultimap
Returns aSetMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
initialCapacity
-- Returns:
-
newLinkedSetMultimap
Returns aSetMultimap
backed byLinkedHashMap
.'Linked'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newSortedSetMultimap
Returns aSetMultimap
backed bySortedMap
.'Sorted'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Returns:
-
newSortedSetMultimap
public static <K extends Comparable<? super K>,E> SetMultimap<K,E> newSortedSetMultimap(Map<? extends K, ? extends E> m) Returns aSetMultimap
backed bySortedMap
.'Sorted'
is about the map, not the value.- Type Parameters:
K
- the key typeE
-- Parameters:
m
-- Returns:
-
newEmptyDataSet
Creates a new empty DataSet. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows or columns.- Returns:
- A new empty DataSet.
- See Also:
-
newEmptyDataSet
Creates a new empty DataSet with the specified column names. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows, but with the specified column names.- Parameters:
columnNames
- A collection of strings representing the names of the columns in the DataSet.- Returns:
- A new empty DataSet with the specified column names.
- See Also:
-
newEmptyDataSet
public static DataSet newEmptyDataSet(Collection<String> columnNames, Map<String, Object> properties) Creates a new empty DataSet with the specified column names and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows, but with the specified column names and properties.- Parameters:
columnNames
- A collection of strings representing the names of the columns in the DataSet.properties
- A map representing the properties of the DataSet. The keys are property names and the values are the corresponding property values.- Returns:
- A new empty DataSet with the specified column names and properties.
- See Also:
-
newDataSet
Creates a new DataSet with the specified rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. The 'rows' parameter is a collection where each item represents a row in the DataSet.- Parameters:
rows
- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean.- Returns:
- A new DataSet with the specified rows.
- Throws:
IllegalArgumentException
- If the provided rows do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<?> rows, Map<String, Object> properties) throws IllegalArgumentExceptionCreates a new DataSet with the specified rows and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. The 'rows' parameter is a collection where each item represents a row in the DataSet. The 'properties' parameter is a map where each entry represents a property of the DataSet.- Parameters:
rows
- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean.properties
- A map of properties for the DataSet. Each key is a property name and each value is the property value.- Returns:
- A new DataSet with the specified rows and properties.
- Throws:
IllegalArgumentException
- If the provided rows and properties do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Collection<?> rows) throws IllegalArgumentException Creates a new DataSet with the specified column names and rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the 'columnNames' collection represents a column in the DataSet. The 'rows' parameter is a collection where each item represents a row in the DataSet. The order of elements in each row should correspond to the order of column names.- Parameters:
columnNames
- A collection of strings representing the names of the columns in the DataSet.rows
- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean/Array/List.- Returns:
- A new DataSet with the specified column names and rows.
- Throws:
IllegalArgumentException
- If the provided columnNames and rows do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Collection<?> rows, Map<String, Object> properties) throws IllegalArgumentExceptionCreates a new DataSet with the specified column names, rows, and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the 'columnNames' collection represents a column in the DataSet. The 'rows' parameter is a collection where each item represents a row in the DataSet. The order of elements in each row should correspond to the order of column names. The 'properties' parameter is a map where each entry represents a property of the DataSet.- Parameters:
columnNames
- A collection of strings representing the names of the columns in the DataSet.rows
- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean/Array/List.properties
- A map of properties for the DataSet. Each key is a property name and each value is the property value.- Returns:
- A new DataSet with the specified column names, rows, and properties.
- Throws:
IllegalArgumentException
- If the provided columnNames and rows do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Object[][] rowList) throws IllegalArgumentException Creates a new DataSet with the specified column names and rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the 'columnNames' collection represents a column in the DataSet. The 'rowList' parameter is a 2D array where each sub-array represents a row in the DataSet. The order of elements in each row should correspond to the order of column names.- Parameters:
columnNames
- A collection of strings representing the names of the columns in the DataSet.rowList
- A 2D array of objects representing the data in the DataSet. Each sub-array is a row.- Returns:
- A new DataSet with the specified column names and rows.
- Throws:
IllegalArgumentException
- If the length of 'columnNames' is not equal to the length of the sub-arrays in 'rowList'.- See Also:
-
newDataSet
Creates a new DataSet from the provided Map. The DataSet will have two columns: one for keys and one for values from the Map.- Parameters:
keyColumnName
- The name of the column for the keys from the Map.valueColumnName
- The name of the column for the values from the Map.m
- The Map to convert into a DataSet.- Returns:
- A new DataSet with two columns: one for keys and one for values from the Map.
-
newDataSet
Creates a new DataSet from the provided Map. The DataSet will have as many columns as there are entries in the Map. The column names are the keys from the Map. Each column corresponds to a Collection in the Map. If a column has fewer rows than the maximum number of rows, the missing rows will be filled withnull
values. Eventually all the columns will have the same number of rows.- Type Parameters:
C
- The type of the Collection values in the Map.- Parameters:
map
- The Map to convert into a DataSet. The keys of the map represent the column names and the values (which are collections) represent the data in the columns.- Returns:
- A new DataSet with columns created from the Map.
-
newDataSet
public static DataSet newDataSet(String columnName, Collection<?> column) throws IllegalArgumentException Creates a new DataSet with single column from the provided Collection. The DataSet will have one column with the provided column name. The data in the column is the data from the provided Collection.- Parameters:
columnName
- The name of the column in the DataSet.column
- The Collection to convert into a DataSet column.- Returns:
- A new DataSet with one column containing the data from the provided Collection.
- Throws:
IllegalArgumentException
- if the provided columnName is empty.
-
merge
Merges two given DataSets into a single DataSet.- Parameters:
a
- The first DataSet to be merged.b
- The second DataSet to be merged.- Returns:
- A new DataSet which is the result of merging DataSet a and DataSet b.
- Throws:
IllegalArgumentException
- if either a or b isnull
.
-
merge
public static DataSet merge(@NotNull DataSet a, @NotNull DataSet b, @NotNull DataSet c) throws IllegalArgumentException Merges three given DataSets into a single DataSet.- Parameters:
a
- The first DataSet to be merged.b
- The second DataSet to be merged.c
- The third DataSet to be merged.- Returns:
- A new DataSet which is the result of merging DataSet a, b and c.
- Throws:
IllegalArgumentException
- if either a, b or c isnull
.
-
merge
Merges a collection of DataSets into a single DataSet.- Parameters:
dss
- The collection of DataSets to be merged.- Returns:
- A new DataSet which is the result of merging all the DataSets in the provided collection.
- Throws:
IllegalArgumentException
- if the provided collection isnull
.
-
merge
public static DataSet merge(Collection<? extends DataSet> dss, boolean requiresSameColumns) throws IllegalArgumentException Merges a collection of DataSets into a single DataSet.- Parameters:
dss
- The collection of DataSets to be merged.requiresSameColumns
- A boolean flag that indicates whether the DataSets in the collection should have the same columns. If set totrue
, all DataSets in the collection must have the same columns. If set tofalse
, the DataSets in the collection can have different columns.- Returns:
- A new DataSet which is the result of merging all the DataSets in the provided collection.
- Throws:
IllegalArgumentException
- if the provided collection isnull
orrequiresSameColumns
istrue
and theDataSets
indss
don't have the same the same column names.
-
toArray
Returns an empty array if the specified collection isnull
or empty.- Parameters:
c
-- Returns:
-
toArray
public static Object[] toArray(Collection<?> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range in the specified collection into an array.- Parameters:
c
- The collection to be converted into an array.fromIndex
- The starting (inclusive) index of the range to be converted.toIndex
- The ending (exclusive) index of the range to be converted.- Returns:
- An array containing the elements of the specified range of the collection.
- Throws:
IndexOutOfBoundsException
- if the provided indices are out of the collection's range.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, @NotNull A[] a) throws IndexOutOfBoundsException, IllegalArgumentException Converts a collection into an array. If the provided array is large enough to hold the elements of the collection, it is filled with the collection's elements, otherwise, a new array of the same runtime type is allocated for this purpose.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.a
- The array into which the elements of the collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- The array containing the elements of the collection. If the provided array was large enough to hold the collection's elements, it is the same as the provided array.
- Throws:
IllegalArgumentException
- if the specifiedArray
isnull
.IndexOutOfBoundsException
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, @NotNull A[] a) throws IllegalArgumentException Converts the specified range in the specified collection into an array. If the provided array is large enough to hold the elements of the collection, it is filled with the collection's elements, otherwise, a new array of the same runtime type is allocated for this purpose.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.fromIndex
- The starting (inclusive) index of the range to be converted.toIndex
- The ending (exclusive) index of the range to be converted.a
- The array into which the elements of the collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- The array containing the elements of the specified portion of the collection. If the provided array was large enough to hold the collection's elements, it is the same as the provided array.
- Throws:
IllegalArgumentException
- if the specifiedArray
isnull
.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, IntFunction<A[]> arraySupplier) Converts a collection into an array using a provided array supplier function. The array supplier function is responsible for creating a new array of the appropriate type and size.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.arraySupplier
- The function to generate a new array of the appropriate type and size.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, IntFunction<A[]> arraySupplier) throws IndexOutOfBoundsException Converts the specified range in the specified collection into an array using a provided array supplier function. The array supplier function is responsible for creating a new array of the appropriate type and size.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.fromIndex
- The starting (inclusive) index of the portion to be converted.toIndex
- The ending (exclusive) index of the portion to be converted.arraySupplier
- The function to generate a new array of the appropriate type and size.- Returns:
- The array containing the elements of the specified portion of the collection.
- Throws:
IndexOutOfBoundsException
- if the specifiedfromIndex
ortoIndex
is out of the collection's range.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, @NotNull Class<A[]> targetType) throws IndexOutOfBoundsException, IllegalArgumentException Converts a collection into an array of a specified type.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.targetType
- The Class object representing the type of the array to be returned.- Returns:
- The array containing the elements of the collection.
- Throws:
IllegalArgumentException
- if the specifiedClass
isnull
.IndexOutOfBoundsException
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, @NotNull Class<A[]> targetType) throws IllegalArgumentException Converts the specified range in the specified collection into an array of a specified type.- Type Parameters:
A
- The type of the array.T
- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c
- The collection to be converted into an array.fromIndex
- The starting (inclusive) index of the range to be converted.toIndex
- The ending (exclusive) index of the range to be converted.targetType
- The Class object representing the type of the array to be returned.- Returns:
- The array containing the elements of the specified portion of the collection.
- Throws:
IllegalArgumentException
- if the specifiedClass
isnull
.IndexOutOfBoundsException
- if the specifiedfromIndex
ortoIndex
is out of the collection's range.
-
toBooleanArray
To boolean array.- Parameters:
c
-- Returns:
-
toBooleanArray
To boolean array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toBooleanArray
To boolean array.- Parameters:
c
-defaultForNull
-- Returns:
-
toBooleanArray
public static boolean[] toBooleanArray(Collection<Boolean> c, int fromIndex, int toIndex, boolean defaultForNull) throws IndexOutOfBoundsException To boolean array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toBooleanArray
public static boolean[] toBooleanArray(byte[] a) Converts a byte array to a boolean array. Each byte with positive value(> 0
) is converted to a boolean valuetrue
,0
and negative value tofalse
.- Parameters:
a
- the byte array to be converted- Returns:
- a boolean array with the same length as the input array, or an empty boolean array if the input array is
null
or empty
-
toBooleanArray
public static boolean[] toBooleanArray(int[] a) Converts an int array to a boolean array. Each int with positive value(> 0
) is converted to a boolean valuetrue
,0
and negative value tofalse
.- Parameters:
a
- the byte array to be converted- Returns:
- a boolean array with the same length as the input array, or an empty boolean array if the input array is
null
or empty
-
toCharArray
To char array.- Parameters:
c
-- Returns:
-
toCharArray
To char array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toCharArray
To char array.- Parameters:
c
-defaultForNull
-- Returns:
-
toCharArray
public static char[] toCharArray(Collection<Character> c, int fromIndex, int toIndex, char defaultForNull) throws IndexOutOfBoundsException To char array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toByteArray
To byte array.- Parameters:
c
-- Returns:
-
toByteArray
To byte array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toByteArray
To byte array.- Parameters:
c
-defaultForNull
-- Returns:
-
toByteArray
public static byte[] toByteArray(Collection<? extends Number> c, int fromIndex, int toIndex, byte defaultForNull) throws IndexOutOfBoundsException To byte array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toByteArray
public static byte[] toByteArray(boolean[] a) Converts a boolean array to a byte array. Each boolean value is converted to a byte value:true
to 1 andfalse
to 0.- Parameters:
a
- the boolean array to be converted- Returns:
- a byte array with the same length as the input array, or an empty byte array if the input array is
null
or empty
-
toShortArray
To short array.- Parameters:
c
-- Returns:
-
toShortArray
To short array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toShortArray
To short array.- Parameters:
c
-defaultForNull
-- Returns:
-
toShortArray
public static short[] toShortArray(Collection<? extends Number> c, int fromIndex, int toIndex, short defaultForNull) throws IndexOutOfBoundsException To short array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toIntArray
To int array.- Parameters:
c
-- Returns:
-
toIntArray
To int array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toIntArray
To int array.- Parameters:
c
-defaultForNull
-- Returns:
-
toIntArray
public static int[] toIntArray(Collection<? extends Number> c, int fromIndex, int toIndex, int defaultForNull) throws IndexOutOfBoundsException To int array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toIntArray
public static int[] toIntArray(char[] a) Converts a char array to an int array. Each char value is converted to its corresponding int value.- Parameters:
a
- the char array to be converted- Returns:
- an int array with the same length as the input array, or an empty byte array if the input array is
null
or empty
-
toIntArray
public static int[] toIntArray(boolean[] a) Converts a boolean array to an int array. Each boolean value is converted to an int value:true
to 1 andfalse
to 0.- Parameters:
a
- the boolean array to be converted- Returns:
- an int array with the same length as the input array, or an empty byte array if the input array is
null
or empty
-
toLongArray
To long array.- Parameters:
c
-- Returns:
-
toLongArray
To long array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toLongArray
To long array.- Parameters:
c
-defaultForNull
-- Returns:
-
toLongArray
public static long[] toLongArray(Collection<? extends Number> c, int fromIndex, int toIndex, long defaultForNull) throws IndexOutOfBoundsException To long array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toFloatArray
To float array.- Parameters:
c
-- Returns:
-
toFloatArray
To float array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toFloatArray
To float array.- Parameters:
c
-defaultForNull
-- Returns:
-
toFloatArray
public static float[] toFloatArray(Collection<? extends Number> c, int fromIndex, int toIndex, float defaultForNull) throws IndexOutOfBoundsException To float array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toDoubleArray
To double array.- Parameters:
c
-- Returns:
-
toDoubleArray
To double array.- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
toDoubleArray
To double array.- Parameters:
c
-defaultForNull
-- Returns:
-
toDoubleArray
public static double[] toDoubleArray(Collection<? extends Number> c, int fromIndex, int toIndex, double defaultForNull) throws IndexOutOfBoundsException To double array.- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Boolean> toList(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Character> toList(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Byte> toList(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Short> toList(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Integer> toList(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Long> toList(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Float> toList(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Parameters:
a
-- Returns:
-
toList
public static List<Double> toList(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
toList
public static <T> List<T> toList(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toList
- Type Parameters:
T
-- Parameters:
iter
-- Returns:
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Boolean> toSet(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Character> toSet(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Byte> toSet(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Short> toSet(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Integer> toSet(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Long> toSet(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Float> toSet(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Parameters:
a
-- Returns:
-
toSet
public static Set<Double> toSet(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
toSet
- Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toSet
- Type Parameters:
T
-- Parameters:
iter
-- Returns:
-
toCollection
public static <C extends Collection<Boolean>> C toCollection(boolean[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Boolean>> C toCollection(boolean[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Character>> C toCollection(char[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Character>> C toCollection(char[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Byte>> C toCollection(byte[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Byte>> C toCollection(byte[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Short>> C toCollection(short[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Short>> C toCollection(short[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Integer>> C toCollection(int[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Integer>> C toCollection(int[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Long>> C toCollection(long[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Long>> C toCollection(long[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Float>> C toCollection(float[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Float>> C toCollection(float[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <C extends Collection<Double>> C toCollection(double[] a, IntFunction<? extends C> supplier) - Type Parameters:
C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <C extends Collection<Double>> C toCollection(double[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
- Type Parameters:
T
-C
-- Parameters:
a
-supplier
-- Returns:
-
toCollection
public static <T,C extends Collection<T>> C toCollection(T[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException - Type Parameters:
T
-C
-- Parameters:
a
-fromIndex
-toIndex
-supplier
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toCollection
public static <T,C extends Collection<T>> C toCollection(Iterable<? extends T> c, IntFunction<? extends C> supplier) - Type Parameters:
T
-C
-- Parameters:
c
-supplier
-- Returns:
-
toCollection
public static <T,C extends Collection<T>> C toCollection(Iterator<? extends T> iter, Supplier<? extends C> supplier) - Type Parameters:
T
-C
-- Parameters:
iter
-supplier
-- Returns:
-
toMap
public static <T,K> Map<K,T> toMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper) throws IllegalArgumentException- Type Parameters:
T
-K
- the key type- Parameters:
c
-keyMapper
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, Map<K,V> V> toMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor) - Type Parameters:
T
-K
- the key typeV
- the value type- Parameters:
c
-keyMapper
-valueExtractor
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) - Type Parameters:
T
-K
- the key typeV
- the value typeM
-- Parameters:
c
-keyMapper
-valueExtractor
-mapSupplier
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, IntFunction<? extends M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
c
-keyMapper
-valueExtractor
-mergeFunction
-mapSupplier
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K> Map<K,T> toMap(Iterator<? extends T> iter, Function<? super T, K> keyMapper) throws IllegalArgumentException- Type Parameters:
T
-K
- the key type- Parameters:
iter
-keyMapper
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, Map<K,V> V> toMap(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor) - Type Parameters:
T
-K
- the key typeV
- the value type- Parameters:
iter
-keyMapper
-valueExtractor
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor, Supplier<? extends M> mapSupplier) - Type Parameters:
T
-K
- the key typeV
- the value typeM
-- Parameters:
iter
-keyMapper
-valueExtractor
-mapSupplier
-- Returns:
- Throws:
IllegalArgumentException
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, throws IllegalArgumentException? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, Supplier<? extends M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
iter
-keyMapper
-valueExtractor
-mergeFunction
-mapSupplier
-- Returns:
- Throws:
IllegalArgumentException
-
asArray
The input array is returned.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asMap
Returns a modifiableMap
with specified key/value.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-- Returns:
-
asMap
Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-- Returns:
-
asMap
Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-- Returns:
-
asMap
Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-- Returns:
-
asMap
Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-- Returns:
-
asMap
public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-k6
-v6
-- Returns:
-
asMap
public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-k6
-v6
-k7
-v7
-- Returns:
-
asMap
Deprecated.Returns a modifiableMap
with specified key/value.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
a
-- Returns:
-
asLinkedHashMap
Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-- Returns:
-
asLinkedHashMap
Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-- Returns:
-
asLinkedHashMap
Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-- Returns:
-
asLinkedHashMap
Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-- Returns:
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-- Returns:
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-k6
-v6
-- Returns:
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
k1
-v1
-k2
-v2
-k3
-v3
-k4
-v4
-k5
-v5
-k6
-v6
-k7
-v7
-- Returns:
-
asLinkedHashMap
Deprecated.Returns a modifiableLinkedHashMap
with specified keys/values.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
a
-- Returns:
-
asProps
Returns a modifiableMap
with specified key/value.- Parameters:
propName
-propValue
-- Returns:
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2) Returns a modifiableMap
with specified keys/values.- Parameters:
propName1
-propValue1
-propName2
-propValue2
-- Returns:
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3) Returns a modifiableMap
with specified keys/values.- Parameters:
propName1
-propValue1
-propName2
-propValue2
-propName3
-propValue3
-- Returns:
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4) Returns a modifiableMap
with specified keys/values.- Parameters:
propName1
-propValue1
-propName2
-propValue2
-propName3
-propValue3
-propName4
-propValue4
-- Returns:
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4, String propName5, Object propValue5) Returns a modifiableMap
with specified keys/values.- Parameters:
propName1
-propValue1
-propName2
-propValue2
-propName3
-propValue3
-propName4
-propValue4
-propName5
-propValue5
-- Returns:
-
asProps
Deprecated.Returns a modifiableMap
with specified keys/values.- Parameters:
a
- pairs of property name and value or a Java Bean Object what allows access to properties using getter and setter methods.- Returns:
-
asList
Returns a modifiableList
with specified element.- Type Parameters:
T
-- Parameters:
e
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-e8
-- Returns:
-
asList
Returns a modifiableList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-e8
-e9
-- Returns:
-
asList
Returns a modifiableList
with specified elements. And it's not backed by the specified array. If the specified array isnull
or empty, an empty modifiableList
is returned.- Type Parameters:
T
-- Parameters:
a
-- Returns:
- See Also:
-
asLinkedList
Returns a modifiableLinkedList
with specified element.- Type Parameters:
T
-- Parameters:
e
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-- Returns:
-
asLinkedList
Returns a modifiableLinkedList
with specified elements. And it's not backed by the specified array. If the specified array isnull
or empty, an empty modifiableList
is returned.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asSet
Returns a modifiableSet
with specified element.- Type Parameters:
T
-- Parameters:
e
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-e8
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-e8
-e9
-- Returns:
-
asSet
Returns a modifiableSet
with specified elements. And it's not backed by the specified array. If the specified array isnull
or empty, an empty modifiableSet
is returned.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified element.- Type Parameters:
T
-- Parameters:
e
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements.- Type Parameters:
T
-- Parameters:
e1
-e2
-e3
-e4
-e5
-e6
-e7
-- Returns:
-
asLinkedHashSet
Returns a modifiableLinkedHashSet
with specified elements. And it's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asSortedSet
Returns a modifiableSortedSet
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asQueue
Returns a modifiableQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asArrayBlockingQueue
Returns a modifiableArrayBlockingQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asLinkedBlockingQueue
Returns a modifiableLinkedBlockingQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asConcurrentLinkedQueue
Returns a modifiableConcurrentLinkedQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asDelayQueue
Returns a modifiableDelayQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asPriorityQueue
Returns a modifiablePriorityQueue
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asDeque
Returns a modifiableDeque
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asArrayDeque
Returns a modifiableArrayDeque
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asLinkedBlockingDeque
Returns a modifiableLinkedBlockingDeque
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asConcurrentLinkedDeque
Returns a modifiableConcurrentLinkedDeque
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asMultiset
Returns a modifiableMultiset
with specified elements. It's not backed by the specified array.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
asSingletonList
Wrap the specified value with a singleton list.- Type Parameters:
T
-- Parameters:
o
-- Returns:
- an immutable/unmodifiable list
- See Also:
-
asSingletonSet
Wrap the specified value with a singleton set.- Type Parameters:
T
-- Parameters:
o
-- Returns:
- an immutable/unmodifiable set
- See Also:
-
asSingletonMap
Wrap the specified key/value with a singleton map.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
key
-value
-- Returns:
- an immutable/unmodifiable Map
- See Also:
-
emptyList
Returns an empty immutable/unmodifiableList
.- Type Parameters:
T
-- Returns:
- See Also:
-
emptySet
Returns an empty immutable/unmodifiableSet
.- Type Parameters:
T
-- Returns:
- See Also:
-
emptySortedSet
Returns an empty immutable/unmodifiableSortedSet
.- Type Parameters:
T
-- Returns:
- See Also:
-
emptyMap
Returns an empty immutable/unmodifiableMap
.- Type Parameters:
K
- the key typeV
- the value type- Returns:
- See Also:
-
emptySortedMap
Returns an empty immutable/unmodifiableSortedMap
.- Type Parameters:
K
- the key typeV
- the value type- Returns:
- See Also:
-
emptyIterator
Returns an empty immutable/unmodifiableIterator
.- Type Parameters:
T
-- Returns:
- See Also:
-
emptyListIterator
Returns an empty immutable/unmodifiableListIterator
.- Type Parameters:
T
-- Returns:
- See Also:
-
emptyInputStream
Returns an empty immutable/unmodifiableInputStream
.- Returns:
-
emptyDataSet
Returns an unmodifiable emptyDataSet
.- Returns:
- See Also:
-
getElement
public static <T> T getElement(@NotNull Iterable<? extends T> c, int index) throws IllegalArgumentException, IndexOutOfBoundsException Retrieves an element from an Iterable at a specified index.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to retrieve the element from. Must not benull
.index
- the index of the element to retrieve. Must be a non-negative integer.- Returns:
- the element at the specified index in the Iterable
- Throws:
IllegalArgumentException
- if the Iterable is nullIndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= size of Iterable)
-
getElement
public static <T> T getElement(@NotNull Iterator<? extends T> iter, long index) throws IllegalArgumentException, IndexOutOfBoundsException Retrieves an element from an Iterator at a specified index.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to retrieve the element from. Must not benull
.index
- the index of the element to retrieve. Must be a non-negative integer.- Returns:
- the element at the specified index in the Iterator
- Throws:
IllegalArgumentException
- if the Iterator is nullIndexOutOfBoundsException
- if the index is out of range (index invalid input: '<' 0 || index >= size of Iterator)
-
getOnlyElement
public static <T> u.Nullable<T> getOnlyElement(Iterable<? extends T> c) throws TooManyElementsException Returns the only element in the given Iterable.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to get the element from- Returns:
- a Nullable containing the only element in the Iterable if it exists, otherwise an empty Nullable
- Throws:
TooManyElementsException
- if the Iterable contains more than one element
-
getOnlyElement
public static <T> u.Nullable<T> getOnlyElement(Iterator<? extends T> iter) throws TooManyElementsException Returns the only element in the given Iterator.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to get the element from- Returns:
- a Nullable containing the only element in the Iterator if it exists, otherwise an empty Nullable
- Throws:
TooManyElementsException
- if the Iterator contains more than one element
-
firstElement
Returns the first element in the given Iterable wrapped in a Nullable. If the Iterable is empty, it returns a Nullable with no value.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to get the first element from- Returns:
- a Nullable containing the first element in the Iterable if it exists, otherwise an empty Nullable
-
firstElement
Returns the first element in the given Iterator wrapped in a Nullable. If the Iterator is empty, it returns a Nullable with no value.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to get the first element from- Returns:
- a Nullable containing the first element in the Iterator if it exists, otherwise an empty Nullable
-
lastElement
Returns the last element in the given Iterable wrapped in a Nullable. If the Iterable is empty, it returns a Nullable with no value.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to get the last element from- Returns:
- a Nullable containing the last element in the Iterable if it exists, otherwise an empty Nullable
-
lastElement
Returns the last element in the given Iterator wrapped in a Nullable. If the Iterator is empty, it returns a Nullable with no value.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to get the last element from- Returns:
- a Nullable containing the last element in the Iterator if it exists, otherwise an empty Nullable
-
firstElements
@Beta public static <T> List<T> firstElements(Iterable<? extends T> c, int n) throws IllegalArgumentException Returns a list containing the first n elements from the given Iterable. If the Iterable has less than n elements, it returns a list with all the elements in the Iterable.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to get the elements fromn
- the number of elements to retrieve from the Iterable- Returns:
- a list containing the first n elements from the Iterable
- Throws:
IllegalArgumentException
- if n is negative
-
firstElements
@Beta public static <T> List<T> firstElements(Iterator<? extends T> iter, int n) throws IllegalArgumentException Returns a list containing the first n elements from the given Iterator. If the Iterator has less than n elements, it returns a list with all the elements in the Iterator.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to get the elements fromn
- the number of elements to retrieve from the Iterator- Returns:
- a list containing the first n elements from the Iterator
- Throws:
IllegalArgumentException
- if n is negative
-
lastElements
@Beta public static <T> List<T> lastElements(Iterable<? extends T> c, int n) throws IllegalArgumentException Returns a list containing the last 'n' elements from the given Iterable. If the Iterable has less than 'n' elements, it returns a list with all the elements in the Iterable.- Type Parameters:
T
- the type of elements in the Iterable- Parameters:
c
- the Iterable to get the elements fromn
- the number of elements to retrieve from the end of the Iterable- Returns:
- a list containing the last 'n' elements from the Iterable
- Throws:
IllegalArgumentException
- if 'n' is negative
-
lastElements
@Beta public static <T> List<T> lastElements(Iterator<? extends T> iter, int n) throws IllegalArgumentException Returns a list containing the last n elements from the given Iterator. If the Iterator has less than n elements, it returns a list with all the elements in the Iterator.- Type Parameters:
T
- the type of elements in the Iterator- Parameters:
iter
- the Iterator to get the elements fromn
- the number of elements to retrieve from the Iterator- Returns:
- a list containing the last n elements from the Iterator
- Throws:
IllegalArgumentException
- if n is negative
-
firstNonNull
Returns the first non-null value among the two provided values. If both values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the first value to checkb
- the second value to check- Returns:
- an Optional containing the first non-null value if it exists, otherwise an empty Optional
-
firstNonNull
Returns the first non-null value among the three provided values. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the first value to checkb
- the second value to checkc
- the third value to check- Returns:
- an Optional containing the first non-null value if it exists, otherwise an empty Optional
-
firstNonNull
Returns the first non-null value among the provided values. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the array of values to check- Returns:
- an Optional containing the first non-null value if it exists, otherwise an empty Optional
-
firstNonNull
Returns the first non-null value from the provided iterable. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
c
- the iterable of values to check- Returns:
- an Optional containing the first non-null value if it exists, otherwise an empty Optional
-
firstNonNull
Returns the first non-null value from the provided iterator. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
iter
- the iterator of values to check- Returns:
- an Optional containing the first non-null value if it exists, otherwise an empty Optional
-
lastNonNull
Returns the last non-null value from the provided values. If both values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the first value to checkb
- the second value to check- Returns:
- an Optional containing the last non-null value if it exists, otherwise an empty Optional
-
lastNonNull
Returns the last non-null value from the provided values. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the first value to checkb
- the second value to checkc
- the third value to check- Returns:
- an Optional containing the last non-null value if it exists, otherwise an empty Optional
-
lastNonNull
Returns the last non-null value from the provided array of values. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
a
- the array of values to check- Returns:
- an Optional containing the last non-null value if it exists, otherwise an empty Optional
-
lastNonNull
Returns the last non-null value from the provided iterable. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
c
- the iterable to check- Returns:
- an Optional containing the last non-null value if it exists, otherwise an empty Optional
-
lastNonNull
Returns the last non-null value from the provided iterator. If all values arenull
, it returns an empty Optional.- Type Parameters:
T
- the type of the values- Parameters:
iter
- the iterator to check- Returns:
- an Optional containing the last non-null value if it exists, otherwise an empty Optional
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
-
firstNonEmpty
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
firstNonBlank
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
firstNonBlank
- Type Parameters:
T
-- Parameters:
a
-b
-c
-- Returns:
-
firstNonBlank
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
firstEntry
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
lastEntry
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
firstOrNullIfEmpty
public static <T> T firstOrNullIfEmpty(T[] a) First ornull
if empty.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
firstOrNullIfEmpty
First ornull
if empty.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
firstOrNullIfEmpty
First ornull
if empty.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
-
firstOrDefaultIfEmpty
public static <T> T firstOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) First or default if empty.- Type Parameters:
T
-- Parameters:
a
-defaultValueForEmpty
-- Returns:
-
firstOrDefaultIfEmpty
First or default if empty.- Type Parameters:
T
-- Parameters:
c
-defaultValueForEmpty
-- Returns:
-
firstOrDefaultIfEmpty
First or default if empty.- Type Parameters:
T
-- Parameters:
iter
-defaultValueForEmpty
-- Returns:
-
lastOrNullIfEmpty
public static <T> T lastOrNullIfEmpty(T[] a) Last ornull
if empty.- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
lastOrNullIfEmpty
Last ornull
if empty.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
lastOrNullIfEmpty
Last ornull
if empty.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
-
lastOrDefaultIfEmpty
public static <T> T lastOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) Last or default if empty.- Type Parameters:
T
-- Parameters:
a
-defaultValueForEmpty
-- Returns:
-
lastOrDefaultIfEmpty
Last or default if empty.- Type Parameters:
T
-- Parameters:
c
-defaultValueForEmpty
-- Returns:
-
lastOrDefaultIfEmpty
Last or default if empty.- Type Parameters:
T
-- Parameters:
iter
-defaultValueForEmpty
-- Returns:
-
findFirst
- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- the nullable
-
findFirst
- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- the nullable
-
findFirst
public static <T> u.Nullable<T> findFirst(Iterator<? extends T> iter, Predicate<? super T> predicate) - Type Parameters:
T
-- Parameters:
iter
-predicate
-- Returns:
-
findLast
- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- the nullable
-
findLast
- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- the nullable
-
findFirstNonNull
Find first nonnull
.- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- the optional
-
findFirstNonNull
public static <T> u.Optional<T> findFirstNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Find first nonnull
.- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- the optional
-
findFirstNonNull
public static <T> u.Optional<T> findFirstNonNull(Iterator<? extends T> iter, Predicate<? super T> predicate) - Type Parameters:
T
-- Parameters:
iter
-predicate
-- Returns:
-
findLastNonNull
Find last nonnull
.- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- the optional
-
findLastNonNull
public static <T> u.Optional<T> findLastNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Find last nonnull
.- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- the optional
-
len
Returns the length of the specifiedCharSequence
, or0
if it's empty ornull
.- Parameters:
s
-- Returns:
-
len
public static int len(boolean[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(char[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(byte[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(short[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(int[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(long[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(float[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
public static int len(double[] a) Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
len
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
a
-- Returns:
-
size
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
c
-- Returns:
-
size
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
m
-- Returns:
-
size
Returns the length/size of the specifiedArray/Collection/Map
, or0
if it's empty ornull
.- Parameters:
c
-- Returns:
-
nullToEmpty
- Parameters:
str
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiable list if the specified List isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
list
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiable set if the specified Set isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
set
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiableSortedSet
if the specified SortedSet isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
set
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiable list if the specified Collection isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable map if the specified Map isnull
, otherwise itself is returned.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiableSortedMap
if the specified SortedMap isnull
, otherwise itself is returned.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiableIterator
if the specified Iterator isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- See Also:
-
nullToEmpty
Returns an empty immutable/unmodifiableListIterator
if the specified ListIterator isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
iter
-- Returns:
- See Also:
-
nullToEmpty
public static boolean[] nullToEmpty(boolean[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static char[] nullToEmpty(char[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static byte[] nullToEmpty(byte[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static short[] nullToEmpty(short[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static int[] nullToEmpty(int[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static long[] nullToEmpty(long[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static float[] nullToEmpty(float[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
public static double[] nullToEmpty(double[] a) Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
- See Also:
-
nullToEmptyForEach
Converts the specified String array to an emptyString[0]
if it'snull
and eachnull
element String to empty String""
.- Parameters:
a
-- Returns:
- See Also:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Parameters:
a
-- Returns:
-
nullToEmpty
Null to empty.- Type Parameters:
T
-- Parameters:
a
-arrayType
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable Collection if the specified ImmutableCollection isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable list if the specified ImmutableList isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
list
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable list if the specified ImmutableSet isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
set
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable list if the specified ImmutableSortedSet isnull
, otherwise itself is returned.- Type Parameters:
T
-- Parameters:
set
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable map if the specified ImmutableMap isnull
, otherwise itself is returned.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable map if the specified ImmutableSortedMap isnull
, otherwise itself is returned.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
nullToEmpty
Returns an empty immutable/unmodifiable map if the specified ImmutableBiMap isnull
, otherwise itself is returned.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
isEmpty
Checks if the specifiedCharSequence
isnull
or empty.- Parameters:
cs
-- Returns:
-
isEmpty
public static boolean isEmpty(boolean[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(char[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(byte[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(short[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(int[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(long[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(float[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
public static boolean isEmpty(double[] a) Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
a
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
c
-- Returns:
true
, if isnull
or empty
-
isEmpty
Notnull
or empty.- Parameters:
iter
-- Returns:
-
isEmpty
Notnull
or empty.- Parameters:
iter
-- Returns:
-
isEmpty
Checks if isnull
or empty.- Parameters:
m
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
list
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
s
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
m
-- Returns:
true
, if isnull
or empty
-
isEmpty
Checks if isnull
or empty.- Parameters:
rs
-- Returns:
true
, if isnull
or empty
-
isBlank
Checks if the specifiedCharSequence
isnull
or blank.- Parameters:
cs
-- Returns:
-
notEmpty
- Parameters:
cs
-- Returns:
-
notEmpty
public static boolean notEmpty(boolean[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(char[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(byte[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(short[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(int[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(long[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(float[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
public static boolean notEmpty(double[] a) Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
a
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
c
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
iter
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
iter
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
m
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
list
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
s
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
m
-- Returns:
-
notEmpty
Notnull
or empty.- Parameters:
rs
-- Returns:
-
notBlank
- Parameters:
cs
-- Returns:
-
anyNull
public static <A,B> boolean anyNull(A a, B b) - Type Parameters:
A
-B
-- Parameters:
a
-b
-- Returns:
-
anyNull
public static <A,B, boolean anyNullC> (A a, B b, C c) - Type Parameters:
A
-B
-C
-- Parameters:
a
-b
-c
-- Returns:
-
anyNull
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
anyNull
- Parameters:
c
-- Returns:
-
anyEmpty
- Parameters:
a
-b
-- Returns:
-
anyEmpty
- Parameters:
a
-b
-c
-- Returns:
-
anyEmpty
Checks if any of the CharSequences are empty ("") or
null
.Strings.anyEmpty((String) null) = true Strings.anyEmpty((String[]) null) = false Strings.anyEmpty(null, "foo") = true Strings.anyEmpty("", "bar") = true Strings.anyEmpty("bob", "") = true Strings.anyEmpty(" bob ", null) = true Strings.anyEmpty(" ", "bar") = false Strings.anyEmpty("foo", "bar") = false Strings.anyEmpty(new String[]{}) = false Strings.anyEmpty(new String[]{""}) = true
- Parameters:
css
- the CharSequences to check, may benull
or empty- Returns:
true
if any of the CharSequences are empty or null- See Also:
-
anyEmpty
- Parameters:
css
-- Returns:
- See Also:
-
anyEmpty
public static <A,B> boolean anyEmpty(A[] a, B[] b) - Type Parameters:
A
-B
-- Parameters:
a
-b
-- Returns:
-
anyEmpty
public static <A,B, boolean anyEmptyC> (A[] a, B[] b, C[] c) - Type Parameters:
A
-B
-C
-- Parameters:
a
-b
-c
-- Returns:
-
anyEmpty
- Parameters:
a
-b
-- Returns:
-
anyEmpty
- Parameters:
a
-b
-c
-- Returns:
-
anyBlank
- Parameters:
a
-b
-- Returns:
-
anyBlank
- Parameters:
a
-b
-c
-- Returns:
-
anyBlank
Checks if any of the CharSequences are empty ("") or
null
or whitespace only.Whitespace is defined by
Character.isWhitespace(char)
.Strings.anyBlank((String) null) = true Strings.anyBlank((String[]) null) = false Strings.anyBlank(null, "foo") = true Strings.anyBlank(null, null) = true Strings.anyBlank("", "bar") = true Strings.anyBlank("bob", "") = true Strings.anyBlank(" bob ", null) = true Strings.anyBlank(" ", "bar") = true Strings.anyBlank(new String[] {}) = false Strings.anyBlank(new String[]{""}) = true Strings.anyBlank("foo", "bar") = false
- Parameters:
css
- the CharSequences to check, may benull
or empty- Returns:
true
if any of the CharSequences are empty ornull
or whitespace only- See Also:
-
anyBlank
- Parameters:
css
-- Returns:
- See Also:
-
allNull
public static <A,B> boolean allNull(A a, B b) - Type Parameters:
A
-B
-- Parameters:
a
-b
-- Returns:
-
allNull
public static <A,B, boolean allNullC> (A a, B b, C c) - Type Parameters:
A
-B
-C
-- Parameters:
a
-b
-c
-- Returns:
-
allNull
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
allNull
- Parameters:
c
-- Returns:
-
allEmpty
- Parameters:
a
-b
-- Returns:
-
allEmpty
- Parameters:
a
-b
-c
-- Returns:
-
allEmpty
Checks if all of the CharSequences are empty ("") or
null
.Strings.allEmpty(null) = true Strings.allEmpty(null, "") = true Strings.allEmpty(new String[] {}) = true Strings.allEmpty(null, "foo") = false Strings.allEmpty("", "bar") = false Strings.allEmpty("bob", "") = false Strings.allEmpty(" bob ", null) = false Strings.allEmpty(" ", "bar") = false Strings.allEmpty("foo", "bar") = false
- Parameters:
css
- the CharSequences to check, may benull
or empty- Returns:
true
if all of the CharSequences are empty or null- See Also:
-
allEmpty
- Parameters:
css
-- Returns:
- See Also:
-
allEmpty
public static <A,B> boolean allEmpty(A[] a, B[] b) - Type Parameters:
A
-B
-- Parameters:
a
-b
-- Returns:
-
allEmpty
public static <A,B, boolean allEmptyC> (A[] a, B[] b, C[] c) - Type Parameters:
A
-B
-C
-- Parameters:
a
-b
-c
-- Returns:
-
allEmpty
- Parameters:
a
-b
-- Returns:
-
allEmpty
- Parameters:
a
-b
-c
-- Returns:
-
allBlank
- Parameters:
a
-b
-- Returns:
-
allBlank
- Parameters:
a
-b
-c
-- Returns:
-
allBlank
Checks if all of the CharSequences are empty (""),
null
or whitespace only.Whitespace is defined by
Character.isWhitespace(char)
.Strings.allBlank(null) = true Strings.allBlank(null, "foo") = false Strings.allBlank(null, null) = true Strings.allBlank("", "bar") = false Strings.allBlank("bob", "") = false Strings.allBlank(" bob ", null) = false Strings.allBlank(" ", "bar") = false Strings.allBlank("foo", "bar") = false Strings.allBlank(new String[] {}) = true
- Parameters:
css
- the CharSequences to check, may benull
or empty- Returns:
true
if all of the CharSequences are empty ornull
or whitespace only- See Also:
-
allBlank
- Parameters:
css
-- Returns:
- See Also:
-
checkIndex
- Parameters:
index
-length
-- Throws:
IndexOutOfBoundsException
- the index out of bounds exception
-
checkFromToIndex
public static void checkFromToIndex(int fromIndex, int toIndex, int length) throws IndexOutOfBoundsException Check from to index.- Parameters:
fromIndex
-toIndex
-length
-- Throws:
IndexOutOfBoundsException
- the index out of bounds exception
-
checkFromIndexSize
public static void checkFromIndexSize(int fromIndex, int size, int length) throws IndexOutOfBoundsException Check from index size.- Parameters:
fromIndex
- the lower-bound (inclusive) of the sub-intervalsize
- the size of the sub-rangelength
- the upper-bound (exclusive) of the range- Throws:
IndexOutOfBoundsException
- the index out of bounds exception
-
checkArgNotNull
Check arg notnull
.- Type Parameters:
T
-- Parameters:
obj
-- Returns:
- Throws:
IllegalArgumentException
- ifobj
isnull
-
checkArgNotNull
Check arg notnull
.- Type Parameters:
T
-- Parameters:
obj
-errorMessage
-- Returns:
- Throws:
IllegalArgumentException
- ifobj
isnull
-
checkArgNotEmpty
public static <T extends CharSequence> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static boolean[] checkArgNotEmpty(boolean[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static char[] checkArgNotEmpty(char[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static byte[] checkArgNotEmpty(byte[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static short[] checkArgNotEmpty(short[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static int[] checkArgNotEmpty(int[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static long[] checkArgNotEmpty(long[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static float[] checkArgNotEmpty(float[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static double[] checkArgNotEmpty(double[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T> T[] checkArgNotEmpty(T[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T extends Collection<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
@Beta public static <T extends Iterable<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
@Beta public static <T extends Iterator<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T extends Map<?,?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T extends PrimitiveList<?,?, T checkArgNotEmpty?>> (T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T> Multiset<T> checkArgNotEmpty(Multiset<T> arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T extends Multimap<?,?, T checkArgNotEmpty?>> (T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotEmpty
public static <T extends DataSet> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
isnull
or empty, and throwsIllegalArgumentException
if it is.- Type Parameters:
T
-- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
isnull
or empty.
-
checkArgNotBlank
public static <T extends CharSequence> T checkArgNotBlank(T arg, String msg) throws IllegalArgumentException Checks if a CharSequence is NOT
null
, empty ("") or whitespace only.- Type Parameters:
T
-- Parameters:
arg
-msg
- name of parameter or error message- Returns:
- Throws:
IllegalArgumentException
- if the specified parameter isnull
, empty ("") or whitespace only.- See Also:
-
checkArgNotNegative
public static byte checkArgNotNegative(byte arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgNotNegative
public static short checkArgNotNegative(short arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgNotNegative
public static int checkArgNotNegative(int arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgNotNegative
public static long checkArgNotNegative(long arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgNotNegative
public static float checkArgNotNegative(float arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgNotNegative
public static double checkArgNotNegative(double arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is not negative, and throwsIllegalArgumentException
if it is.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static byte checkArgPositive(byte arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static short checkArgPositive(short arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static int checkArgPositive(int arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static long checkArgPositive(long arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static float checkArgPositive(float arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkArgPositive
public static double checkArgPositive(double arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specifiedarg
is positive, and throwsIllegalArgumentException
if it is not.- Parameters:
arg
-argNameOrErrorMsg
-- Returns:
- Throws:
IllegalArgumentException
- if the specifiedarg
is negative.
-
checkElementNotNull
Check if the specifiedArray
contains anynull
element.- Parameters:
a
-- Throws:
IllegalArgumentException
- ifnull
element found ina
-
checkElementNotNull
public static void checkElementNotNull(Object[] a, String argNameOrErrorMsg) throws IllegalArgumentException Check if the specifiedArray
contains anynull
element.- Parameters:
a
-argNameOrErrorMsg
-- Throws:
IllegalArgumentException
- ifnull
element found ina
-
checkElementNotNull
Check if the specifiedCollection
contains anynull
element.- Parameters:
c
-- Throws:
IllegalArgumentException
- ifnull
element found inc
-
checkElementNotNull
public static void checkElementNotNull(Collection<?> c, String argNameOrErrorMsg) throws IllegalArgumentException Check if the specifiedCollection
contains anynull
element.- Parameters:
c
-argNameOrErrorMsg
-- Throws:
IllegalArgumentException
- ifnull
element found inc
-
checkKeyNotNull
Check if the specifiedMap
contains anynull
key.- Parameters:
m
-- Throws:
IllegalArgumentException
- ifnull
key found inm
-
checkKeyNotNull
public static void checkKeyNotNull(Map<?, ?> m, String argNameOrErrorMsg) throws IllegalArgumentExceptionCheck if the specifiedMap
contains anynull
key.- Parameters:
m
-argNameOrErrorMsg
-- Throws:
IllegalArgumentException
- ifnull
key found inm
-
checkValueNotNull
Check if the specifiedMap
contains anynull
value.- Parameters:
m
-- Throws:
IllegalArgumentException
- ifnull
value found inm
-
checkValueNotNull
public static void checkValueNotNull(Map<?, ?> m, String argNameOrErrorMsg) throws IllegalArgumentExceptionCheck if the specifiedMap
contains anynull
value.- Parameters:
m
-argNameOrErrorMsg
-- Throws:
IllegalArgumentException
- ifnull
value found inm
-
checkArgument
Ensures the truth of an expression involving one or more parameters to the calling method.- Parameters:
expression
- a boolean expression- Throws:
IllegalArgumentException
- ifexpression
is false
-
checkArgument
public static void checkArgument(boolean expression, String errorMessage) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.- Parameters:
expression
- a boolean expressionerrorMessage
- the exception message to use if the check fails; will be converted to a string usingString.valueOf(Object)
- Throws:
IllegalArgumentException
- ifexpression
is false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, boolean p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, boolean p1, boolean p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, boolean p1, boolean p2, boolean p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, byte p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, short p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, int p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, int p2, int p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, long p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, long p2, long p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, float p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, float p1, float p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, float p1, float p2, float p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, double p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, double p2, double p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, Object p2) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) throws IllegalArgumentException Ensures the truth of an expression involving one or more parameters to the calling method.See
checkArgument(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-- Throws:
IllegalArgumentException
-
checkArgument
public static void checkArgument(boolean b, Supplier<String> errorMessageSupplier) throws IllegalArgumentException - Parameters:
b
-errorMessageSupplier
-- Throws:
IllegalArgumentException
-
checkState
public static void checkState(boolean expression) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.- Parameters:
expression
- a boolean expression- Throws:
IllegalStateException
- ifexpression
is false
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.- Parameters:
expression
- a boolean expressionerrorMessage
- the exception message to use if the check fails; will be converted to a string usingString.valueOf(Object)
- Throws:
IllegalStateException
- ifexpression
is false
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, double p2, double p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p
-
-
checkState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.See
checkState(boolean, String, Object...)
for details.- Parameters:
b
-errorMessageTemplate
-p1
-p2
-p3
-
-
checkState
- Parameters:
b
-errorMessageSupplier
-
-
requireNonNull
Ensures that the specified object reference is notnull
.- Type Parameters:
T
- the type of the object- Parameters:
obj
- the object reference to check for nullity- Returns:
- the non-null object reference that was validated
- Throws:
NullPointerException
- if the specifiedobj
isnull
- See Also:
-
requireNonNull
Ensures that the specified object reference is notnull
.- Type Parameters:
T
- the type of the object- Parameters:
obj
- the object reference to check for nullityerrorMessage
- the detail message to be used in the event that aNullPointerException
is thrown- Returns:
- the non-null object reference that was validated
- Throws:
NullPointerException
- if the specifiedobj
isnull
- See Also:
-
requireNonNull
@Beta public static <T> T requireNonNull(T obj, Supplier<String> errorMessageSupplier) throws NullPointerException Ensures that the specified object reference is notnull
.- Type Parameters:
T
- the type of the object- Parameters:
obj
- the object reference to check for nullityerrorMessageSupplier
- the supplier of the detail message to be used in the event that aNullPointerException
is thrown- Returns:
- the non-null object reference that was validated
- Throws:
NullPointerException
- if the specifiedobj
isnull
- See Also:
-
compare
public static int compare(boolean a, boolean b) - Parameters:
a
-b
-- Returns:
-
compare
public static int compare(byte a, byte b) - Parameters:
a
-b
-- Returns:
-
compareUnsigned
public static int compareUnsigned(byte a, byte b) - Parameters:
a
-b
-- Returns:
- See Also:
-
compare
public static int compare(short a, short b) - Parameters:
a
-b
-- Returns:
-
compareUnsigned
public static int compareUnsigned(short a, short b) - Parameters:
a
-b
-- Returns:
- See Also:
-
compare
public static int compare(int a, int b) - Parameters:
a
-b
-- Returns:
-
compareUnsigned
public static int compareUnsigned(int a, int b) - Parameters:
a
-b
-- Returns:
- See Also:
-
compare
public static int compare(long a, long b) - Parameters:
a
-b
-- Returns:
-
compareUnsigned
public static int compareUnsigned(long a, long b) - Parameters:
a
-b
-- Returns:
- See Also:
-
compare
public static int compare(float a, float b) - Parameters:
a
-b
-- Returns:
-
compare
public static int compare(double a, double b) - Parameters:
a
-b
-- Returns:
-
compare
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
compare
Returns 0 if the arguments are identical andc.compare(a, b)
otherwise. Consequently, if both arguments arenull
0 is returned.Note that if one of the arguments is
null
, aNullPointerException
may or may not be thrown depending on what ordering policy, if any, theComparator
chooses to have fornull
values.- Type Parameters:
T
- the type of the objects being compared- Parameters:
a
- an objectb
- an object to be compared witha
cmp
- theComparator
to compare the first two arguments- Returns:
- 0 if the arguments are identical and
c.compare(a, b)
otherwise. - See Also:
-
compare
public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>> int compare(T1 a1, T1 b1, T2 a2, T2 b2) Continue to compare the pairs of values(a1, b1), (a2, b2)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-- Parameters:
a1
-b1
-a2
-b2
-- Returns:
-
compare
public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3) Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-T3
-- Parameters:
a1
-b1
-a2
-b2
-a3
-b3
-- Returns:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4) Deprecated.please useBuilder.ComparisonBuilder
Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3), (a4, b4)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-T3
-T4
-- Parameters:
a1
-b1
-a2
-b2
-a3
-b3
-a4
-b4
-- Returns:
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5) Deprecated.please useBuilder.ComparisonBuilder
Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3), (a4, b4), (a5, b5)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-T3
-T4
-T5
-- Parameters:
a1
-b1
-a2
-b2
-a3
-b3
-a4
-b4
-a5
-b5
-- Returns:
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6) Deprecated.please useBuilder.ComparisonBuilder
Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3), (a4, b4), (a5, b5), (a6, b6)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-T3
-T4
-T5
-T6
-- Parameters:
a1
-b1
-a2
-b2
-a3
-b3
-a4
-b4
-a5
-b5
-a6
-b6
-- Returns:
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>, T7 extends Comparable<T7>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6, T7 a7, T7 b7) Deprecated.please useBuilder.ComparisonBuilder
Continue to compare the pairs of values(a1, b1), (a2, b2), (a3, b3), (a4, b4), (a5, b5), (a6, b6), (a7, b7)
until they're not equal.0
is returned if all of the pairs of values are equal.- Type Parameters:
T1
-T2
-T3
-T4
-T5
-T6
-T7
-- Parameters:
a1
-b1
-a2
-b2
-a3
-b3
-a4
-b4
-a5
-b5
-a6
-b6
-a7
-b7
-- Returns:
- See Also:
-
compare
public static int compare(boolean[] a, boolean[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
public static int compare(char[] a, char[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
public static int compare(byte[] a, byte[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(byte[] a, byte[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to comparefromIndexA
- the starting index (inclusive) of the first subarrayb
- the second array to comparefromIndexB
- the starting index (inclusive) of the second subarraylen
- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(short[] a, short[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(short[] a, short[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to comparefromIndexA
- the starting index (inclusive) of the first subarrayb
- the second array to comparefromIndexB
- the starting index (inclusive) of the second subarraylen
- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(int[] a, int[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(int[] a, int[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to comparefromIndexA
- the starting index (inclusive) of the first subarrayb
- the second array to comparefromIndexB
- the starting index (inclusive) of the second subarraylen
- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(long[] a, long[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(long[] a, long[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a
- the first array to comparefromIndexA
- the starting index (inclusive) of the first subarrayb
- the second array to comparefromIndexB
- the starting index (inclusive) of the second subarraylen
- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(float[] a, float[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
public static int compare(double[] a, double[] b) Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
Compares two arrays lexicographically.- Parameters:
a
- the first array to compareb
- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static <T extends Comparable<? super T>> int compare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
Compares two arrays using the specified comparator.- Type Parameters:
T
- the type of elements in the arrays- Parameters:
a
- the first array to compareb
- the second array to comparecmp
- the comparator to compare array elements- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
-
compare
public static <T> int compare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range using the specified comparator.- Parameters:
a
- the first array to comparefromIndexA
- the starting index in the first arrayb
- the second array to comparefromIndexB
- the starting index in the second arraylen
- the number of elements to comparecmp
- the comparator to compare array elements- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
public static <T> int compare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two collections lexicographically over the specified range.- Parameters:
a
- the first collection to comparefromIndexA
- the starting index in the first collectionb
- the second collection to comparefromIndexB
- the starting index in the second collectionlen
- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first collection is less than, equal to, or greater than the second collection
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the specified ranges are out of bounds
-
compare
Compares two iterables lexicographically.- Type Parameters:
T
- the type of elements in the iterables, which must be comparable- Parameters:
a
- the first iterable to compareb
- the second iterable to compare- Returns:
- a negative integer, zero, or a positive integer as the first iterable is less than, equal to, or greater than the second iterable
-
compare
Compares two iterators lexicographically.- Type Parameters:
T
- the type of elements in the iterators, which must be comparable- Parameters:
a
- the first iterator to compareb
- the second iterator to compare- Returns:
- a negative integer, zero, or a positive integer as the first iterator is less than, equal to, or greater than the second iterator
-
compare
public static <T> int compare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Compares two collections lexicographically over the specified range using the specified comparator.- Type Parameters:
T
- the type of elements in the collections- Parameters:
a
- the first collection to comparefromIndexA
- the starting index in the first collectionb
- the second collection to comparefromIndexB
- the starting index in the second collectionlen
- the number of elements to comparecmp
- the comparator to compare collection elements- Returns:
- a negative integer, zero, or a positive integer as the first collection is less than, equal to, or greater than the second collection
- Throws:
IllegalArgumentException
- if the specified length is negativeIndexOutOfBoundsException
- if the specified indices are out of range
-
compare
Compares two iterables using the specified comparator.- Type Parameters:
T
- the type of elements in the iterables- Parameters:
a
- the first iterable to compareb
- the second iterable to comparecmp
- the comparator to compare elements from iterables- Returns:
- a negative integer, zero, or a positive integer as the first iterable is less than, equal to, or greater than the second iterable
-
compare
Compares two iterators using the specified comparator.- Type Parameters:
T
- the type of elements in the iterators- Parameters:
a
- the first iterator to compareb
- the second iterator to comparecmp
- the comparator to compare elements from iterators- Returns:
- a negative integer, zero, or a positive integer as the first iterator is less than, equal to, or greater than the second iterator
-
compareIgnoreCase
Compares two strings lexicographically, ignoring case differences.- Parameters:
a
- the first string to compareb
- the second string to compare- Returns:
- a negative integer, zero, or a positive integer as the first string is less than, equal to, or greater than the second string, ignoring case considerations
-
compareIgnoreCase
Compares two arrays of strings lexicographically, ignoring case differences.- Parameters:
a
- the first array of strings to compareb
- the second array of strings to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array, ignoring case considerations
-
compareByProps
@Deprecated public static int compareByProps(@NotNull Object bean1, @NotNull Object bean2, Collection<String> propNamesToCompare) Deprecated.callgetPropValue
by reflection apis during comparing or sorting may have huge impact to performance. UseBuilder.ComparisonBuilder
instead.- Parameters:
bean1
-bean2
-propNamesToCompare
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
mismatch
public static int mismatch(boolean[] a, boolean[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first boolean arrayb
- the second boolean array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two boolean arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first boolean arrayfromIndexA
- the starting index in the first arrayb
- the second boolean arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(char[] a, char[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first char arrayb
- the second char array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two char arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first char arrayfromIndexA
- the starting index in the first arrayb
- the second char arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(byte[] a, byte[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first byte arrayb
- the second byte array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two byte arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first byte arrayfromIndexA
- the starting index in the first arrayb
- the second byte arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(short[] a, short[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first short arrayb
- the second short array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two short arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first short arrayfromIndexA
- the starting index in the first arrayb
- the second short arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(int[] a, int[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first int arrayb
- the second int array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two int arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first int arrayfromIndexA
- the starting index in the first arrayb
- the second int arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(long[] a, long[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first long arrayb
- the second long array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two long arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first long arrayfromIndexA
- the starting index in the first arrayb
- the second long arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(float[] a, float[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first float arrayb
- the second float array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two float arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first float arrayfromIndexA
- the starting index in the first arrayb
- the second float arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(double[] a, double[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Parameters:
a
- the first double arrayb
- the second double array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static int mismatch(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two double arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first double arrayfromIndexA
- the starting index in the first arrayb
- the second double arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the arrays, which must be Comparable- Parameters:
a
- the first arrayb
- the second array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static <T extends Comparable<? super T>> int mismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first arrayfromIndexA
- the starting index in the first arrayb
- the second arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the arrays, which must be Comparable- Parameters:
a
- the first arrayb
- the second arraycmp
- the comparator to compare array elements- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
null
or empty. - See Also:
-
mismatch
public static <T> int mismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a
- the first arrayfromIndexA
- the starting index in the first arrayb
- the second arrayfromIndexB
- the starting index in the second arraylen
- the number of elements to comparecmp
- the comparator to compare array elements- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static <T> int mismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two collections starting from specified indices. If the collections are identical in the specified range, returns -1.- Type Parameters:
T
- the type of elements in the collections- Parameters:
a
- the first collectionfromIndexA
- the starting index in the first collectionb
- the second collectionfromIndexB
- the starting index in the second collectionlen
- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the collections are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterables. If the iterables are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the iterables- Parameters:
a
- the first iterableb
- the second iterable- Returns:
- the index of the first mismatch, or -1 if the iterables are identical or both are
null
or empty - See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterators. If the iterators are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the iterators- Parameters:
a
- the first iteratorb
- the second iterator- Returns:
- the index of the first mismatch, or -1 if the iterators are identical or both are
null
or empty - See Also:
-
mismatch
public static <T> int mismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two collections starting from specified indices. If the collections are identical in the specified range, returns -1.- Type Parameters:
T
- the type of elements in the collections- Parameters:
a
- the first collectionfromIndexA
- the starting index in the first collectionb
- the second collectionfromIndexB
- the starting index in the second collectionlen
- the number of elements to comparecmp
- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the collections are identical in the specified range
- Throws:
IllegalArgumentException
- if the length is negativeIndexOutOfBoundsException
- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterables using the specified comparator. If the iterables are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the iterables- Parameters:
a
- the first iterableb
- the second iterablecmp
- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the iterables are identical or both are
null
or empty - See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterators using the specified comparator. If the iterators are identical or both arenull
or empty, returns -1.- Type Parameters:
T
- the type of elements in the iterators- Parameters:
a
- the first iteratorb
- the second iteratorcmp
- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the iterators are identical or both are
null
or empty - See Also:
-
lessThan
Returnstrue
isa < b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
lessThan
Returnstrue
isa < b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-cmp
-- Returns:
-
lessEqual
Returnstrue
isa <= b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
lessEqual
Returnstrue
isa <= b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-cmp
-- Returns:
-
greaterThan
Returnstrue
isa > b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
greaterThan
Returnstrue
isa > b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-cmp
-- Returns:
-
greaterEqual
Returnstrue
isa >= b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-
greaterEqual
Returnstrue
isa >= b
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
a
-b
-cmp
-- Returns:
-
gtAndLt
Returnstrue
ismin < value < max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-- Returns:
-
gtAndLt
Returnstrue
ismin < value < max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-cmp
-- Returns:
-
geAndLt
Returnstrue
ismin <= value < max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-- Returns:
-
geAndLt
Returnstrue
ismin <= value < max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-cmp
-- Returns:
-
geAndLe
Returnstrue
ismin <= value <= max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-- Returns:
-
geAndLe
Returnstrue
ismin <= value <= max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-cmp
-- Returns:
-
gtAndLe
Returnstrue
ismin < value <= max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-- Returns:
-
gtAndLe
Returnstrue
ismin < value <= max
, otherwisefalse
is returned.- Type Parameters:
T
-- Parameters:
value
-min
-max
-cmp
-- Returns:
-
isBetween
@Deprecated public static <T extends Comparable<? super T>> boolean isBetween(T value, T min, T max) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)
- Type Parameters:
T
-- Parameters:
value
-min
-max
-- Returns:
-
isBetween
Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)
- Type Parameters:
T
-- Parameters:
value
-min
-max
-cmp
-- Returns:
-
equals
public static boolean equals(boolean a, boolean b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(char a, char b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(byte a, byte b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(short a, short b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(int a, int b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(long a, long b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(float a, float b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(double a, double b) - Parameters:
a
-b
-- Returns:
- boolean
-
equals
- Parameters:
a
-b
-- Returns:
-
equalsIgnoreCase
Equals ignore case.- Parameters:
a
-b
-- Returns:
-
equals
- Parameters:
a
-b
-- Returns:
- boolean
-
equals
public static boolean equals(boolean[] a, boolean[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(char[] a, char[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(byte[] a, byte[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(short[] a, short[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(int[] a, int[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(long[] a, long[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(float[] a, float[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
public static boolean equals(double[] a, double[] b) - Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equals
- Parameters:
a
-b
-- Returns:
- boolean
- See Also:
-
equals
public static boolean equals(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
deepEquals
- Parameters:
a
-b
-- Returns:
- boolean
-
deepEquals
- Parameters:
a
-b
-- Returns:
- See Also:
-
deepEquals
public static boolean deepEquals(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException - Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equalsIgnoreCase
Equals ignore case.- Parameters:
a
-b
-- Returns:
-
equalsIgnoreCase
public static boolean equalsIgnoreCase(String[] a, int fromIndexA, String[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Equals ignore case.- Parameters:
a
-fromIndexA
-b
-fromIndexB
-len
-- Returns:
- Throws:
IllegalArgumentException
IndexOutOfBoundsException
-
equalsByProps
public static boolean equalsByProps(Object bean1, Object bean2, Collection<String> propNamesToCompare) throws IllegalArgumentException - Parameters:
bean1
-bean2
-propNamesToCompare
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
equalsByCommonProps
public static boolean equalsByCommonProps(@NotNull Object bean1, @NotNull Object bean2) throws IllegalArgumentException - Parameters:
bean1
-bean2
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
hashCode
public static int hashCode(boolean value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(char value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(byte value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(short value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(int value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(long value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(float value) - Parameters:
value
-- Returns:
- int
-
hashCode
public static int hashCode(double value) - Parameters:
value
-- Returns:
- int
-
hashCode
- Parameters:
obj
-- Returns:
- int
-
hashCode
public static int hashCode(boolean[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
public static int hashCode(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(char[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(byte[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(short[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(int[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(long[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(float[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
public static int hashCode(double[] a) - Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
hashCode
- Parameters:
a
-- Returns:
- See Also:
-
hashCode
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
deepHashCode
- Parameters:
obj
-- Returns:
- int
-
deepHashCode
Deep hash code.- Parameters:
a
-- Returns:
- See Also:
-
deepHashCode
public static int deepHashCode(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Deep hash code.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
value
-- Returns:
- int
-
toString
- Parameters:
obj
-- Returns:
- int
-
toString
- Parameters:
a
-defaultIfNull
-- Returns:
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
toString
- Parameters:
a
-- Returns:
- See Also:
-
toString
public static String toString(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
deepToString
- Parameters:
obj
-- Returns:
- int
-
deepToString
Deep to string.- Parameters:
a
-- Returns:
- See Also:
-
deepToString
public static String deepToString(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Deep to string.- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
deepToString
Deep to string.- Parameters:
a
-defaultIfNull
-- Returns:
-
reverse
public static void reverse(boolean[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
public static void reverse(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(char[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(byte[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(short[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(int[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(long[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(float[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
public static void reverse(double[] a) Reverses the order of the given array.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
Reverses the order of the given array.
There is no special handling for multi-dimensional arrays.
- Parameters:
a
-
-
reverse
Reverses the order of the given array in the given range.
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
- Parameters:
list
-
-
reverse
public static void reverse(List<?> list, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
list
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
reverse
- Parameters:
c
-
-
reverseToList
- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
rotate
public static void rotate(boolean[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(char[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(byte[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(short[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(int[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(long[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(float[] a, int distance) - Parameters:
a
-distance
-
-
rotate
public static void rotate(double[] a, int distance) - Parameters:
a
-distance
-
-
rotate
- Parameters:
a
-distance
-
-
rotate
- Parameters:
list
-distance
-- See Also:
-
rotate
- Parameters:
c
-distance
-
-
shuffle
public static void shuffle(boolean[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(char[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(byte[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(short[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(int[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(long[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(float[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static void shuffle(double[] a) - Parameters:
a
-
-
shuffle
- Parameters:
a
-rnd
-
-
shuffle
public static <T> void shuffle(T[] a) - Type Parameters:
T
-- Parameters:
a
-
-
shuffle
- Type Parameters:
T
-- Parameters:
a
-rnd
-
-
shuffle
- Parameters:
list
-
-
shuffle
- Parameters:
list
-rnd
-- See Also:
-
shuffle
- Parameters:
c
-
-
shuffle
- Parameters:
c
-rnd
-
-
swap
public static void swap(boolean[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(char[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(byte[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(short[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(int[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(long[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(float[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
public static void swap(double[] a, int i, int j) - Parameters:
a
-i
-j
-
-
swap
- Parameters:
a
-i
-j
-
-
swap
- Parameters:
list
-i
-j
-
-
swap
- Type Parameters:
T
-- Parameters:
pair
-
-
swapIf
- Type Parameters:
T
-- Parameters:
pair
-predicate
-- Returns:
-
swap
- Type Parameters:
T
-M
-- Parameters:
triple
-
-
swapIf
public static <T,M> boolean swapIf(Triple<T, M, T> triple, Predicate<? super Triple<T, M, T>> predicate) - Type Parameters:
T
-M
-- Parameters:
triple
-predicate
-- Returns:
-
fill
public static void fill(boolean[] a, boolean val) - Parameters:
a
-val
-
-
fill
public static void fill(boolean[] a, int fromIndex, int toIndex, boolean val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(char[] a, char val) - Parameters:
a
-val
-
-
fill
public static void fill(char[] a, int fromIndex, int toIndex, char val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(byte[] a, byte val) - Parameters:
a
-val
-
-
fill
public static void fill(byte[] a, int fromIndex, int toIndex, byte val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(short[] a, short val) - Parameters:
a
-val
-
-
fill
public static void fill(short[] a, int fromIndex, int toIndex, short val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(int[] a, int val) - Parameters:
a
-val
-
-
fill
public static void fill(int[] a, int fromIndex, int toIndex, int val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(long[] a, long val) - Parameters:
a
-val
-
-
fill
public static void fill(long[] a, int fromIndex, int toIndex, long val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(float[] a, float val) - Parameters:
a
-val
-
-
fill
public static void fill(float[] a, int fromIndex, int toIndex, float val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
public static void fill(double[] a, double val) - Parameters:
a
-val
-
-
fill
public static void fill(double[] a, int fromIndex, int toIndex, double val) - Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
- Parameters:
a
-val
-
-
fill
- Parameters:
a
-fromIndex
-toIndex
-val
-
-
fill
- Type Parameters:
T
-- Parameters:
list
-val
-- See Also:
-
fill
public static <T> void fill(List<? super T> list, int fromIndex, int toIndex, T val) throws IndexOutOfBoundsException The specified value will be added/inserted into the specified List. The List will be extended automatically if the size of the List is less than the specified toIndex.- Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-val
-- Throws:
IndexOutOfBoundsException
- See Also:
-
fill
Fill the properties of the bean with random values.- Parameters:
bean
- a bean object with getter/setter method
-
fill
Fill the properties of the bean with random values.- Type Parameters:
T
-- Parameters:
beanClass
- bean class with getter/setter methods- Returns:
-
fill
Fill the properties of the bean with random values.- Type Parameters:
T
-- Parameters:
beanClass
- bean class with getter/setter methodscount
-- Returns:
-
padLeft
public static <T> boolean padLeft(List<T> list, int minSize, T objToAdd) throws IllegalArgumentException Appends the provided object to the beginning of the list till the list has at least the specified minimum size.- Type Parameters:
T
- the type of the elements in the list- Parameters:
list
- the list to be paddedminSize
- the minimum size the list should have after this operationobjToAdd
- the object to add to the list if it is smaller than the specified minimum size- Returns:
true
if the list was modified as a result of this operation,false
otherwise- Throws:
IllegalArgumentException
- if the provided list is null
-
padRight
public static <T> boolean padRight(Collection<T> c, int minSize, T objToAdd) throws IllegalArgumentException Appends the provided object to the end of the list till the list has at least the specified minimum size.- Type Parameters:
T
-- Parameters:
c
-minSize
-objToAdd
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
repeat
- Type Parameters:
T
-- Parameters:
value
-n
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
repeatElements
public static <T> List<T> repeatElements(Collection<? extends T> c, int n) throws IllegalArgumentException Repeats the elements in the specified Collection one by one.repeatElements(N.asList(1, 2, 3), 2) => [1, 1, 2, 2, 3, 3]
- Type Parameters:
T
-- Parameters:
c
-n
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
repeatCollection
Repeats the entire specified Collectionn
times.repeatCollection(N.asList(1, 2, 3), 2) => [1, 2, 3, 1, 2, 3]
- Type Parameters:
T
-- Parameters:
c
-n
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
repeatElementsToSize
public static <T> List<T> repeatElementsToSize(Collection<T> c, int size) throws IllegalArgumentException Repeats the elements in the specified Collection one by one till reach the specified size.repeatElementsToSize(N.asList(1, 2, 3), 5) => [1, 1, 2, 2, 3]
- Type Parameters:
T
-- Parameters:
c
-size
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
repeatCollectionToSize
public static <T> List<T> repeatCollectionToSize(Collection<? extends T> c, int size) throws IllegalArgumentException Repeats the entire specified Collection till reach the specified size.repeatCollectionToSize(N.asList(1, 2, 3), 5) => [1, 2, 3, 1, 2]
- Type Parameters:
T
-- Parameters:
c
-size
-- Returns:
- Throws:
IllegalArgumentException
- See Also:
-
copy
Copies all of the elements from one list into another. After the operation, the index of each copied element in the destination list will be identical to its index in the source list. The destination list must be at least as long as the source list. If it is longer, the remaining elements in the destination list are unaffected.This method runs in linear time.
- Type Parameters:
T
-- Parameters:
src
-dest
-- Throws:
IndexOutOfBoundsException
- if the destination list is too small to contain the entire source List.UnsupportedOperationException
- if the destination list's list-iterator does not support the set operation.- See Also:
-
copy
public static <T> void copy(List<? extends T> src, int srcPos, List<? super T> dest, int destPos, int length) throws IndexOutOfBoundsException Copies a portion of one list into another. The portion to be copied begins at the index srcPos in the source list and spans length elements. The elements are copied into the destination list starting at position destPos. Both source and destination positions are zero-based.- Type Parameters:
T
- the type of elements in the lists- Parameters:
src
- the source list from which to copy elementssrcPos
- the starting position in the source listdest
- the destination list into which to copy elementsdestPos
- the starting position in the destination listlength
- the number of elements to be copied- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside list bounds
-
copy
public static void copy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(char[] src, int srcPos, char[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(byte[] src, int srcPos, byte[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(short[] src, int srcPos, short[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(int[] src, int srcPos, int[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(long[] src, int srcPos, long[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(float[] src, int srcPos, float[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(double[] src, int srcPos, double[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(Object[] src, int srcPos, Object[] dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
-
copy
public static void copy(Object src, int srcPos, Object dest, int destPos, int length) throws IndexOutOfBoundsException - Parameters:
src
-srcPos
-dest
-destPos
-length
-- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOf
public static boolean[] copyOf(boolean[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static char[] copyOf(char[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static byte[] copyOf(byte[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static short[] copyOf(short[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static int[] copyOf(int[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static long[] copyOf(long[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static float[] copyOf(float[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static double[] copyOf(double[] original, int newLength) - Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
public static <T> T[] copyOf(T[] original, int newLength) - Type Parameters:
T
-- Parameters:
original
-newLength
-- Returns:
- See Also:
-
copyOf
- Type Parameters:
T
-U
-- Parameters:
original
-newLength
-newType
-- Returns:
- See Also:
-
copyOfRange
public static boolean[] copyOfRange(boolean[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static boolean[] copyOfRange(boolean[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static char[] copyOfRange(char[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static char[] copyOfRange(char[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static byte[] copyOfRange(byte[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static byte[] copyOfRange(byte[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static short[] copyOfRange(short[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static short[] copyOfRange(short[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static int[] copyOfRange(int[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static int[] copyOfRange(int[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.int[] a = { 0, 1, 2, 3, 4, 5 }; N.copyOfRange(a, 1, 5, 1)); // [1, 2, 3, 4] N.copyOfRange(a, 1, 5, 2); // [1, 3] N.copyOfRange(a, 5, 1, -1); // [5, 4, 3, 2] N.copyOfRange(a, 5, 1, -2); // [5, 3] N.copyOfRange(a, 5, -1, -1); // [5, 4, 3, 2, 1, 0] N.copyOfRange(a, 6, -1, -1); // [5, 4, 3, 2, 1, 0]
- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
-
copyOfRange
public static long[] copyOfRange(long[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static long[] copyOfRange(long[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static float[] copyOfRange(float[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static float[] copyOfRange(float[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static double[] copyOfRange(double[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static double[] copyOfRange(double[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex) Copy all the elements inoriginal
, throughto
-from
.- Type Parameters:
T
-- Parameters:
original
-fromIndex
-toIndex
-- Returns:
- See Also:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex, int step) Copy all the elements inoriginal
, throughto
-from
, bystep
.- Type Parameters:
T
-- Parameters:
original
-fromIndex
-toIndex
-step
-- Returns:
-
copyOfRange
public static <T,U> T[] copyOfRange(U[] original, int fromIndex, int toIndex, Class<? extends T[]> newType) - Type Parameters:
T
-U
-- Parameters:
original
-fromIndex
-toIndex
-newType
-- Returns:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex, int step, Class<? extends T[]> newType) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Type Parameters:
T
-- Parameters:
original
-fromIndex
-toIndex
-step
-newType
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
copyOfRange
public static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the elements inoriginal
, throughto
-from
, bystep
.- Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
-
copyOfRange
Copy all the chars inoriginal
, throughto
-from
.- Parameters:
str
-fromIndex
-toIndex
-- Returns:
-
copyOfRange
public static String copyOfRange(String str, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Copy all the chars inoriginal
, throughto
-from
, bystep
.- Parameters:
str
-fromIndex
-toIndex
-step
-- Returns:
- Throws:
IndexOutOfBoundsException
- See Also:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array.null
is returned if the input array isnull
.- Type Parameters:
T
-- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Type Parameters:
T
-- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Parameters:
original
-- Returns:
-
clone
Clone the original array and its sub arrays.null
is returned if the input array isnull
.- Type Parameters:
T
-- Parameters:
original
-- Returns:
-
isSorted
public static boolean isSorted(boolean[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(char[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(byte[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(short[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(int[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(long[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(float[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
public static boolean isSorted(double[] a) - Parameters:
a
-- Returns:
-
isSorted
public static boolean isSorted(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
isSorted
public static <T extends Comparable<? super T>> boolean isSorted(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
- Type Parameters:
T
-- Parameters:
a
-cmp
-- Returns:
-
isSorted
public static <T> boolean isSorted(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
isSorted
public static <T extends Comparable<? super T>> boolean isSorted(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-- Returns:
- Throws:
IndexOutOfBoundsException
-
isSorted
- Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
-
isSorted
public static <T> boolean isSorted(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
c
-fromIndex
-toIndex
-cmp
-- Returns:
- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(boolean[] a) - Parameters:
a
-
-
sort
public static void sort(char[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(byte[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(short[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(int[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(long[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(float[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
public static void sort(double[] a) - Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
sort
- Parameters:
a
-
-
sort
- Parameters:
a
-fromIndex
-toIndex
-
-
sort
- Type Parameters:
T
-- Parameters:
a
-cmp
-
-
sort
public static <T> void sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Throws:
IndexOutOfBoundsException
-
sort
- Type Parameters:
T
-- Parameters:
list
-
-
sort
public static <T extends Comparable<? super T>> void sort(List<? extends T> list, int fromIndex, int toIndex) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-
-
sort
- Type Parameters:
T
-- Parameters:
list
-cmp
-
-
sort
public static <T> void sort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-cmp
-
-
sortBy
public static <T,U extends Comparable<? super U>> void sortBy(T[] a, Function<? super T, ? extends U> keyMapper) - Type Parameters:
T
-U
-- Parameters:
a
-keyMapper
-
-
sortBy
public static <T,U extends Comparable<? super U>> void sortBy(List<? extends T> list, Function<? super T, ? extends U> keyMapper) - Type Parameters:
T
-U
-- Parameters:
list
-keyMapper
-
-
sortByInt
Sort by int.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
sortByInt
Sort by int.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
sortByLong
Sort by long.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
sortByLong
Sort by long.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
sortByFloat
Sort by float.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
sortByFloat
Sort by float.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
sortByDouble
Sort by double.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
sortByDouble
Sort by double.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
parallelSort
public static void parallelSort(char[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(byte[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(short[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(int[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(long[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(float[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
public static void parallelSort(double[] a) - Parameters:
a
-
-
parallelSort
public static void parallelSort(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
- Type Parameters:
T
-- Parameters:
a
-
-
parallelSort
public static <T extends Comparable<? super T>> void parallelSort(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
parallelSort
- Type Parameters:
T
-- Parameters:
a
-cmp
-
-
parallelSort
public static <T> void parallelSort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-cmp
-- Throws:
IndexOutOfBoundsException
-
parallelSort
- Type Parameters:
T
-- Parameters:
list
-
-
parallelSort
public static <T extends Comparable<? super T>> void parallelSort(List<? extends T> list, int fromIndex, int toIndex) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-
-
parallelSort
- Type Parameters:
T
-- Parameters:
list
-cmp
-
-
parallelSort
public static <T> void parallelSort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-cmp
-
-
parallelSortBy
public static <T,U extends Comparable<? super U>> void parallelSortBy(T[] a, Function<? super T, ? extends U> keyMapper) Parallel sort by.- Type Parameters:
T
-U
-- Parameters:
a
-keyMapper
-
-
parallelSortBy
public static <T,U extends Comparable<? super U>> void parallelSortBy(List<? extends T> list, Function<? super T, ? extends U> keyMapper) Parallel sort by.- Type Parameters:
T
-U
-- Parameters:
list
-keyMapper
-
-
parallelSortByInt
Parallel sort by int.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
parallelSortByInt
public static <T> void parallelSortByInt(List<? extends T> list, ToIntFunction<? super T> keyMapper) Parallel sort by int.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
parallelSortByLong
Parallel sort by long.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
parallelSortByLong
public static <T> void parallelSortByLong(List<? extends T> list, ToLongFunction<? super T> keyMapper) Parallel sort by long.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
parallelSortByFloat
Parallel sort by float.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
parallelSortByFloat
public static <T> void parallelSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyMapper) Parallel sort by float.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
parallelSortByDouble
Parallel sort by double.- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
parallelSortByDouble
public static <T> void parallelSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyMapper) Parallel sort by double.- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
reverseSort
public static void reverseSort(boolean[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(char[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(char[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(byte[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(byte[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(short[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(short[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(int[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(int[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(long[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(long[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(float[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(float[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
public static void reverseSort(double[] a) - Parameters:
a
-
-
reverseSort
public static void reverseSort(double[] a, int fromIndex, int toIndex) - Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
- Parameters:
a
-
-
reverseSort
- Parameters:
a
-fromIndex
-toIndex
-
-
reverseSort
- Type Parameters:
T
-- Parameters:
list
-
-
reverseSort
public static <T extends Comparable<? super T>> void reverseSort(List<? extends T> list, int fromIndex, int toIndex) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-
-
reverseSortBy
public static <T,U extends Comparable<? super U>> void reverseSortBy(T[] a, Function<? super T, ? extends U> keyMapper) Reverse sort by.- Type Parameters:
T
-U
-- Parameters:
a
-keyMapper
-
-
reverseSortBy
public static <T,U extends Comparable<? super U>> void reverseSortBy(List<? extends T> list, Function<? super T, ? extends U> keyMapper) Reverse sort by.- Type Parameters:
T
-U
-- Parameters:
list
-keyMapper
-
-
reverseSortByInt
- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
reverseSortByInt
- Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
reverseSortByLong
- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
reverseSortByLong
public static <T> void reverseSortByLong(List<? extends T> list, ToLongFunction<? super T> keyMapper) - Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
reverseSortByFloat
- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
reverseSortByFloat
public static <T> void reverseSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyMapper) - Type Parameters:
T
-- Parameters:
list
-keyMapper
-
-
reverseSortByDouble
- Type Parameters:
T
-- Parameters:
a
-keyMapper
-
-
reverseSortByDouble
public static <T> void reverseSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyMapper) throws IndexOutOfBoundsException - Type Parameters:
T
-- Parameters:
list
-keyMapper
-- Throws:
IndexOutOfBoundsException
-
binarySearch
public static int binarySearch(char[] a, char valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(char[] a, int fromIndex, int toIndex, char valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(byte[] a, byte valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(byte[] a, int fromIndex, int toIndex, byte valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(short[] a, short valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(short[] a, int fromIndex, int toIndex, short valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(int[] a, int valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(int[] a, int fromIndex, int toIndex, int valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(long[] a, long valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(long[] a, int fromIndex, int toIndex, long valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(float[] a, float valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(float[] a, int fromIndex, int toIndex, float valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(double[] a, double valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
public static int binarySearch(double[] a, int fromIndex, int toIndex, double valueToFind) - Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
- Parameters:
a
-valueToFind
-- Returns:
-
binarySearch
- Parameters:
a
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
- Type Parameters:
T
-- Parameters:
a
-valueToFind
-cmp
-- Returns:
-
binarySearch
public static <T> int binarySearch(T[] a, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) - Type Parameters:
T
-- Parameters:
a
-fromIndex
-toIndex
-valueToFind
-cmp
-- Returns:
-
binarySearch
public static <T extends Comparable<? super T>> int binarySearch(List<? extends T> list, T valueToFind) - Type Parameters:
T
-- Parameters:
list
-valueToFind
-- Returns:
-
binarySearch
public static <T extends Comparable<? super T>> int binarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-valueToFind
-- Returns:
-
binarySearch
public static <T> int binarySearch(List<? extends T> list, T valueToFind, Comparator<? super T> cmp) - Type Parameters:
T
-- Parameters:
list
-valueToFind
-cmp
-- Returns:
-
binarySearch
public static <T> int binarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) - Type Parameters:
T
-- Parameters:
list
-fromIndex
-toIndex
-valueToFind
-cmp
-- Returns:
- See Also:
-
indexOf
public static int indexOf(boolean[] a, boolean valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(boolean[] a, boolean valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(char[] a, char valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(char[] a, char valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(byte[] a, byte valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(byte[] a, byte valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(short[] a, short valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(short[] a, short valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(int[] a, int valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(int[] a, int valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(long[] a, long valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(long[] a, long valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(float[] a, float valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(float[] a, float valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(double[] a, double valueToFind) - Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(double[] a, double valueToFind, int fromIndex) - Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
public static int indexOf(double[] a, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.- Parameters:
a
- the array to search through for the object, may benull
valueToFind
-tolerance
- tolerance of the search- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-
indexOf
public static int indexOf(double[] a, double valueToFind, double tolerance, int fromIndex) Finds the index of the given value in the array starting at the given index. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.A negative startIndex is treated as zero. A startIndex larger than the array length will return
INDEX_NOT_FOUND
(-1
).- Parameters:
a
- the array to search through for the object, may benull
valueToFind
-tolerance
- tolerance of the searchfromIndex
- the index to start searching at- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-
indexOf
- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
- Parameters:
a
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
- Parameters:
c
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
- Parameters:
c
-valueToFind
-fromIndex
- the index from which to start the search.- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOf
Returns the index of the first occurrence of the specified value in the given iterator.- Parameters:
iter
- The iterator to be searched.valueToFind
- The value to find in the iterator.- Returns:
- The index of the first occurrence of the specified value in the iterator, or -1 if the value is not found.
- Throws:
ArithmeticException
- If the foundindex
overflows an int.
-
indexOf
public static int indexOf(Iterator<?> iter, Object valueToFind, int fromIndex) throws ArithmeticException Returns the index of the first occurrence of the specified value in the given iterator, starting the search from the specified index.- Parameters:
iter
- The iterator to be searched.valueToFind
- The value to find in the iterator.fromIndex
- The index to start the search from.- Returns:
- The index of the first occurrence of the specified value in the iterator, or -1 if the value is not found.
- Throws:
ArithmeticException
- If the foundindex
overflows an int.
-
indexOfSubList
Index of sub list.- Parameters:
sourceList
-subListToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.- See Also:
-
indexOfSubList
Index of sub list.- Parameters:
sourceList
-subListToFind
-fromIndex
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.- See Also:
-
indexOfIgnoreCase
- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
indexOfIgnoreCase
- Parameters:
a
-valueToFind
-fromIndex
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(boolean[] a, boolean valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(boolean[] a, boolean valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(char[] a, char valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(char[] a, char valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(byte[] a, byte valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(byte[] a, byte valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(short[] a, short valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(short[] a, short valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(int[] a, int valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(int[] a, int valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(long[] a, long valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(long[] a, long valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(float[] a, float valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(float[] a, float valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind) Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, int startIndexFromBack) Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.- Parameters:
a
- the array to search through for the object, may benull
valueToFind
-tolerance
- tolerance of the search- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, double tolerance, int startIndexFromBack) Finds the last index of the given value in the array starting at the given index. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND
(-1
) for anull
input array.A negative startIndex will return
INDEX_NOT_FOUND
(-1
). A startIndex larger than the array length will search from the end of the array.- Parameters:
a
- the array to traverse for looking for the object, may benull
valueToFind
-tolerance
- search for value within plus/minus this amountstartIndexFromBack
- the start index to traverse backwards from- Returns:
- the last index of the value within the array,
INDEX_NOT_FOUND
(-1
) if not found ornull
array input
-
lastIndexOf
Last index of.- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
Last index of.- Parameters:
a
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
Last index of.- Parameters:
c
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOf
Last index of.- Parameters:
c
-valueToFind
-startIndexFromBack
- the start index to traverse backwards from- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOfSubList
Last index of sub list.- Parameters:
sourceList
-subListToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.- See Also:
-
lastIndexOfSubList
public static int lastIndexOfSubList(List<?> sourceList, List<?> subListToFind, int startIndexFromBack) Last index of sub list.- Parameters:
sourceList
-subListToFind
-startIndexFromBack
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.- See Also:
-
lastIndexOfIgnoreCase
- Parameters:
a
-valueToFind
-- Returns:
-1
if no target value/element is found in the specifiedCollection/Array
.
-
lastIndexOfIgnoreCase
- Parameters:
a
-valueToFind
-startIndexFromBack
-- Returns:
-
findFirstIndex
Find first index.- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findFirstIndex
public static <T,U> u.OptionalInt findFirstIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Find first index.- Type Parameters:
T
-U
-- Parameters:
a
-u
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findFirstIndex
public static <T> u.OptionalInt findFirstIndex(Collection<? extends T> c, Predicate<? super T> predicate) Find first index.- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findFirstIndex
public static <T,U> u.OptionalInt findFirstIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Find first index.- Type Parameters:
T
-U
-- Parameters:
c
-u
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findLastIndex
Find last index.- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findLastIndex
public static <T,U> u.OptionalInt findLastIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Find last index.- Type Parameters:
T
-U
-- Parameters:
a
-u
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findLastIndex
public static <T> u.OptionalInt findLastIndex(Collection<? extends T> c, Predicate<? super T> predicate) Find last index.- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
findLastIndex
public static <T,U> u.OptionalInt findLastIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) - Type Parameters:
T
-U
-- Parameters:
c
-u
-predicate
-- Returns:
- an
OptionalInt
with the index of found target value/element, or an emptyOptionalInt
no target value/element found.
-
indicesOfAllMin
public static <T extends Comparable<? super T>> int[] indicesOfAllMin(T[] a) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
a
-- Returns:
- the indices of all minimum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMin
public static <T> int[] indicesOfAllMin(T[] a, Comparator<? super T> cmp) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
a
-cmp
-- Returns:
- the indices of all minimum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMin
public static <T extends Comparable<? super T>> int[] indicesOfAllMin(Collection<? extends T> c) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
c
-- Returns:
- the indices of all minimum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMin
public static <T> int[] indicesOfAllMin(Collection<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- the indices of all minimum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T extends Comparable<? super T>> int[] indicesOfAllMax(T[] a) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
a
-- Returns:
- the indices of all maximum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T> int[] indicesOfAllMax(T[] a, Comparator<? super T> cmp) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
a
-cmp
-- Returns:
- the indices of all maximum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T extends Comparable<? super T>> int[] indicesOfAllMax(Collection<? extends T> c) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
c
-- Returns:
- the indices of all maximum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T> int[] indicesOfAllMax(Collection<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException - Type Parameters:
T
-- Parameters:
c
-cmp
-- Returns:
- the indices of all maximum value/element in the specified
Collection/Array
. - Throws:
IllegalArgumentException
-
indicesOfAll
- Parameters:
a
-valueToFind
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Parameters:
a
-valueToFind
-startIndex
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Parameters:
c
-valueToFind
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Parameters:
c
-valueToFind
-startIndex
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Type Parameters:
T
-- Parameters:
a
-predicate
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Type Parameters:
T
-- Parameters:
a
-predicate
-startIndex
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
- Type Parameters:
T
-- Parameters:
c
-predicate
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
indicesOfAll
public static <T> int[] indicesOfAll(Collection<? extends T> c, Predicate<? super T> predicate, int fromIndex) - Type Parameters:
T
-- Parameters:
c
-predicate
-fromIndex
-- Returns:
- the indices of all found target value/element in the specified
Collection/Array
.
-
isTrue
Returnstrue
if the specifiedboolean
isBoolean.TRUE
, notnull
orBoolean.FALSE
.- Parameters:
bool
-- Returns:
-
isNotTrue
Returnstrue
if the specifiedboolean
isnull
orBoolean.FALSE
.- Parameters:
bool
-- Returns:
-
isFalse
Returnstrue
if the specifiedboolean
isBoolean.FALSE
, notnull
orBoolean.TRUE
.- Parameters:
bool
-- Returns:
-
isNotFalse
Returnstrue
if the specifiedboolean
isnull
orBoolean.TRUE
.- Parameters:
bool
-- Returns:
-
negate
Note: copied from Apache commons Lang under Apache license v2.0
Negates the specified boolean.
If
null
is passed in,null
will be returned.NOTE: This returns
null
and will throw a NullPointerException if autoboxed to a boolean.BooleanUtils.negate(Boolean.TRUE) = Boolean.FALSE; BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE; BooleanUtils.negate(null) = null;
- Parameters:
bool
- the Boolean to negate, may be null- Returns:
- the negated Boolean, or
null
ifnull
input
-
negate
Negates boolean values in the specified boolean array
.- Parameters:
a
-
-
negate
@Beta public static void negate(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Negates boolean values
.fromIndex
totoIndex
in the specified boolean array- Parameters:
a
-fromIndex
-toIndex
-- Throws:
IndexOutOfBoundsException
-
unmodifiableCollection
Returns anunmodifiable view
of the specifiedCollection
. Or an emptyCollection
if the specifiedcollection
isnull
.- Type Parameters:
T
-- Parameters:
c
-- Returns:
- an empty
Collection
if the specifiedc
isnull
.
-
unmodifiableList
Returns anunmodifiable view
of the specifiedList
. Or an emptyList
if the specifiedlist
isnull
.- Type Parameters:
T
-- Parameters:
list
-- Returns:
-
unmodifiableSet
Returns anunmodifiable view
of the specifiedSet
. Or an emptySet
if the specifiedset
isnull
.- Type Parameters:
T
-- Parameters:
s
-- Returns:
-
unmodifiableSortedSet
Returns anunmodifiable view
of the specifiedSortedSet
. Or an emptySortedSet
if the specifiedset
isnull
.- Type Parameters:
T
-- Parameters:
s
-- Returns:
-
unmodifiableMap
Returns anunmodifiable view
of the specifiedMap
. Or an emptyMap
if the specifiedmap
isnull
.- Type Parameters:
K
-V
-- Parameters:
m
-- Returns:
- See Also:
-
unmodifiableSortedMap
Returns anunmodifiable view
of the specifiedSortedMap
. Or an emptySortedMap
if the specifiedmap
isnull
.- Type Parameters:
K
-V
-- Parameters:
m
-- Returns:
- See Also:
-
Builder.ComparisonBuilder