Tuesday, 31 December 2019

Java equivalent of Python "join" method for array?

How can I do this Python trick in Java?



>>> l = [1,2,3,4,5]
>>> print ' '.join(l)
1 2 3 4 5


This doesn't apply to Strings only. I am using generics and need to print any kind of value in the Array.

No comments:

Post a Comment