It’s a fairly common task for a Java developer to convert a list to an array or from an array to a list. Like many things in Java, there is often more than one way to accomplish a task. In this post, I’ll discuss the various approaches to converting data between list objects and arrays.

Converting List to Array

The list interface comes with the toArray() method that returns an array containing all of the elements in this list in proper sequence (from the first to last element). The type of returned array is that of the array that you pass as the parameter.

Source de l’article sur DZONE

L’assistance proposée par ANKAA PMO

ANKAA PMO présent depuis plus de 20 ans sur le marché des services IT, accompagne les DSI dans leur recherche de compétences pour des besoins de renforts en mode régie ou l’externalisation de projets.
Vous souhaitez plus d’information ? Cliquez ici


0 réponses

Laisser un commentaire

Participez-vous à la discussion?
N'hésitez pas à contribuer!

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *