Guava’s Ints.join() returns a string containing the supplied int values separated by separator.
For example, join(“-“, 1, 2, 3) returns the string “1-2-3”.
public static String join(String separator, int array)
Parameters: This method takes the following paramters:
- separator: The text that should appear between consecutive values in the resulting string (but not at the start or end).
- array: An array of int values.
Return Value: This method returnst a string containing the supplied int values separated by separator.
Below examples illustrate the Ints.join() method:
2, 4, 6, 8, 10
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.