Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




join( ) FUNCTION


join( ) Function


The join( ) Function is used to join all the elements of a collection(i.e. list, set e.t.c.) into one string.


Example :


x = ['Hello', 'Beautiful', 'World']
y = "@".join(x)
print(y)


Output :



  Hello@Beautiful@World

In the above code, we have declared a list with values 'Hello', 'Beautiful' and 'World'.And assigned it to a variable 'x'.


x = ['Hello', 'Beautiful', 'World']

java_Collections

Then we have used the 'join( )' function to take all the three values from the list and join them separated using '@'.


y = "@".join(x)

java_Collections