java - converting elements of a list to string -


I would like to get the string text of the elements stored in a list, list & lt; Cars & gt; . ToArray () and toString () will be the best choice of methods?

Yes, but doing it manually gives you more control:

  // Start list with exact length & lt; String & gt; String list = new array list & lt; String & gt; (ListOfCard.size ()); For (car car: inventory permission) {stringsList.add (car.toString ()); }  

If you do not override the toString () method and do not want to override the ID, you can use the car.getName () isttead's car.toString () (or any asset combination like you)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -