Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Convert String Array to List in Java

When we wish to work with multiple values of the same type, the most tempting data Structure to use is Array. This provide a simple and fast way to create and manage multiple instances of a Class. It is easy and intuitive to use. However, one frustrating limitation of Arrays is that the number of items it holds is not flexible. Meaning we are stuck with a fixed number of items throughout the lifetime of the data structure. It is not possible to add more items later. That is why if we need flexibility, Lists are much better to work with. To cater the transition from one data structure to another, below are some examples on how to convert a String Array to List in Java.



This post first appeared on Grails Cookbook, please read the originial post: here

Share the post

Convert String Array to List in Java

×

Subscribe to Grails Cookbook

Get updates delivered right to your inbox!

Thank you for your subscription

×