Home » Core Java » apache » commons » lang3 » Page 2

lang3

Convert array to Map

In this example we shall show you how to convert an array to a Map. We are using the org.apache.commons.lang3.ArrayUtils class, that provides operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). This class tries to handle null input gracefully. An exception will not be thrown for a null array input. To convert an array to a ...

Read More »

Array reverse order

With this example we are going to demonstrate how to reverse the order of an array. We are using the org.apache.commons.lang3.ArrayUtils class, that provides operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). In short, to reverse the order of an array you should: Create a String array. Use the toString(Object array) method of ArrayUtils to get ...

Read More »

Array of Objects to Array of primitives

This is an example of how to convert an array of Objects to an array of primitives. We are using the org.apache.commons.lang3.ArrayUtils class, that provides operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). Converting an array of Objects to an array of primitives implies that you should: Create an array of Integer objects. Convert the objects ...

Read More »

Check empty string

In this example we shall show you how to check if a String is empty. We are using the org.apache.commons.lang3.StringUtils class, that provides operations on String that are null safe.. To check if a String is empty one should perform the following steps: Create a few String objects. Use the isBlank(String s) method to check if a String contains text. Use the ...

Read More »

Find elements in an array

With this example we are going to demonstrate how to find elements in an array. We are using the org.apache.commons.lang3.ArrayUtils class, that provides operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). In short, to find elements in an array you should: Create a String array. Use contains(Object[] array, Object objectToFind) method of ArrayUtils to check if ...

Read More »