Java String join


The java string join() method returns a string joined with given delimiter. In string join method, delimiter is copied for each elements.

In case of null element, "null" is added. The join() method is included in java string since JDK 1.8.

There are two types of join() methods in java string.


Signature

The signature of intern method is given below:

public static String join(CharSequence delimiter, CharSequence... elements)
and
public static String join(CharSequence delimiter, Iterable elements)



Paremeters

delimiter : char value to be added with each element

element :char value to be attached with delimiter


Returns

joined string with delimiter


Throws

NullPointerException if element or delimiter is null.


Since

1.8

Java String equals() method example

Flash soon



Copyright 2017 Design& Development