How to Convert Collection to String in Java - Spring Framework Example
How to convert Collection to String in Java
Many times we need to convert any Collection like Set or List into String like comma separated or any other delimiter delimited String. Though this is quite a trivial job for a Java programmer as you just need to Iterate through the loop and create a big String where individual String are separated by a delimiter, you still need to handle cases like the last element should not have delimiter or at a bare minimum you need to test that code. I like Joshua Bloch advice on Effective Java to use libraries for those common tasks let it be an internal proprietary library or any open source library as used in previous examples of Spring, Apache Commons or Google�s Guava but point is that you should avoid converting ArrayList to String like common task by yourself on application code.
Comments
Post a Comment
-Berkomentarlah yang baik dan rapi.
-Menggunakan link aktif akan dihapus.