Java Guava | Booleans.concat() method with Examples Last Updated : 30 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The concat() method of Booleans Class in the Guava library is used to concatenate the values of many arrays into a single array. These boolean arrays to be concatenated are specified as parameters to this method. For example: concat(new boolean[] {a, b}, new boolean[] {}, new boolean[] {c} returns the array {a, b, c}. Syntax : public static boolean[] concat(boolean[]... arrays) Parameter: This method accepts arrays as parameter which is the boolean arrays to be concatenated by this method. Return Value: This method returns a single boolean array which contains all the specified boolean array values in its original order. Below programs illustrate the use of concat() method: Example-1 : Java // Java code to show implementation of // Guava's Booleans.concat() method import com.google.common.primitives.Booleans; import java.util.Arrays; class GFG { // Driver's code public static void main(String[] args) { // Creating 2 Boolean arrays boolean[] arr1 = { true, false, true }; boolean[] arr2 = { false, false, false, true }; // Using Booleans.concat() method to combine // elements from both arrays into a single array boolean[] res = Booleans.concat(arr1, arr2); // Displaying the single combined array System.out.println(Arrays.toString(res)); } } Output: [true, false, true, false, false, false, true] Example-2 : Java // Java code to show implementation of // Guava's Booleans.concat() method import com.google.common.primitives.Booleans; import java.util.Arrays; class GFG { // Driver's code public static void main(String[] args) { // Creating 4 boolean arrays boolean[] arr1 = { true, false, false }; boolean[] arr2 = { true, true }; boolean[] arr3 = { false, false, false }; boolean[] arr4 = { false, true }; // Using Booleans.concat() method to combine // elements from both arrays into a single array boolean[] res = Booleans.concat(arr1, arr2, arr3, arr4); // Displaying the single combined array System.out.println(Arrays.toString(res)); } } Output: [true, false, false, true, true, false, false, false, false, true] Reference: https://google.github.io/guava/releases/20.0/api/docs/com/google/common/primitives/Booleans.html#concat-boolean:A...- Comment More infoAdvertise with us Next Article Java Guava | Booleans.concat() method with Examples S Sahil_Bansall Follow Improve Article Tags : Java java-guava Java-Boolean Practice Tags : Java Similar Reads Java Guava | Booleans.contains() method with Examples The contains() method of Booleans Class in Guava library is used to check if a specified value is present in the specified array of boolean values. The boolean value to be searched and the boolean array in which it is to be searched, are both taken as a parameter. Syntax : public static boolean cont 2 min read Java Guava | Booleans.compare() method with Examples The compare() method of Booleans Class in the Guava library is used to compare the two specified boolean values. These values are passed as the parameter and the result of comparison is found as the difference of 1st value and the 2nd value. Hence it can be positive, zero or negative. Syntax: public 2 min read Java Guava | Booleans.asList() method with Examples The Booleans.asList() method of Guava's Booleans Class accepts a boolean array as a parameter and returns a list which has the fixed size. The returned list is backed by the boolean array which is passed as the argument. It means the changes made in the array passed as parameter will be reflected ba 2 min read Boolean compare() method in Java with Examples The compare() method of Boolean class is a built in method in Java which is used to compare two boolean values. It is a static method, so it can be called without creating any object of the Boolean class i.e. directly using the class name. Syntax: Boolean.compare(boolean a, boolean b) Parameters: It 2 min read Java Guava | Longs.concat() method with Examples The concat() method of Longs Class in the Guava library is used to concatenate the values of many arrays into a single array. These long arrays to be concatenated are specified as parameters to this method. For example: concat(new long[] {1, 2}, new long[] {3, 4, 5}, new long[] {6, 7} returns the ar 3 min read Boolean compareTo() method in Java with examples The compareTo() method of Boolean class is a built in method in Java which is used to compare the given Boolean instance with the current instance. Syntax: BooleanObject.compareTo(Boolean a) Parameters: It takes a Boolean value a as parameter which is to be compared with the current instance. Return 2 min read Java Guava | Shorts.concat() method with Examples Shorts.concat() is a method of Shorts class in Guava library which is used to concatenate the values of multiple arrays into a single array. For example, concat(new short[] {a, b}, new short[] {}, new short[] {c} returns the array {a, b, c}. Syntax : public static short[] concat(short[]... arrays) H 2 min read Java Guava | Booleans.hashCode() method with Examples Booleans.hashCode() is a method of Booleans class in Guava Library which is used to return a hash code for a boolean value. The hashCode is an unique integer value that is calculated by the compiler for an object. It remain the same if the object value does not changes. Syntax: public static int has 1 min read Boolean equals() method in Java with examples The equals() method of Boolean class is a built in method of Java which is used check equality of two Boolean object. Syntax: BooleanObject.equals(Object ob) Parameter: It take a parameter ob of type Object as input which is the instance to be compared. Return Type: The return type is boolean. It re 2 min read Boolean booleanValue() method in Java with examples The booleanValue() method of Boolean Class is a built in method in java which is used to return the primitive boolean value of instance which is used to call the method booleanValue(). Syntax BooleanObject.booleanValue() Return Value: It returns a primitive boolean value. Below are the examples to i 1 min read Like