Java Guava | Booleans.join() method with Examples
The join() method of Booleans Class in the Guava library is used to combine or join all the given boolean values separated by a separator. These boolean values are passed a parameter to this method. This method also takes the separator as the parameter. This method returns a String which is the result of join operation on the specified boolean values.
For example: join(“-“, false, true, false) returns the string “false-true-false”.
public static String join(String separator, boolean... array)
Parameters: This method accepts two mandatory parameters:
- separator: which is the character that occurs in between the joined boolean values
- array: which is an array of boolean values that are to be joined.
Return Value: This method returns a string containing all the given boolean values separated by separator.
Below programs illustrate the use of this method:
Example 2 :