About 104,000 results
Open links in new tab
  1. java - Create ArrayList from array - Stack Overflow

    Oct 1, 2008 · Given: Element[] array = new Element[] { new Element(1), new Element(2), new Element(3) }; The simplest answer is to do:

  2. java - From Arraylist to Array - Stack Overflow

    Nov 1, 2011 · In older Java versions using pre-sized array was recommended, as the reflection call which is necessary to create an array of proper size was quite slow. However since late …

  3. Converting array to list in Java - Stack Overflow

    How do I convert an array to a list in Java? I used the Arrays.asList() but the behavior (and signature) somehow changed from Java SE 1.4.2 (docs now in archive) to 8 and most …

  4. java - Best way to convert an ArrayList to a string - Stack Overflow

    Mar 1, 2009 · Java 8 introduces a String.join(separator, list) method; see Vitalii Federenko's answer. Before Java 8, using a loop to iterate over the ArrayList was the only option: DO NOT …

  5. Convert list to array in Java - Stack Overflow

    There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray(new String[c.size()])) or using an empty array (like c.toArray(new String[0]). In older …

  6. Convert two dimensional array to List in java? - Stack Overflow

    Jul 12, 2012 · Here is a step by step solution to convert a 2D array of int (i.e. primitive data types) to a list. The explanations are in the code comments.

  7. Converting 'ArrayList<String> to 'String []' in Java - Stack Overflow

    Oct 28, 2010 · String[] array = list.toArray(ArrayUtils.EMPTY_STRING_ARRAY); // or if using static import String[] array = list.toArray(EMPTY_STRING_ARRAY); There are a few more …

  8. java - Converting an ArrayList into a 2D Array - Stack Overflow

    Jan 27, 2010 · So Above is a way to convert your ArrayList<string> to a 2D Array. Above i have converted ArrayList<string> into 2D Object. For converting it into 2D string or 2D array just …

  9. java - How to convert an ArrayList containing Integers to primitive …

    Apr 5, 2009 · Converting primitive array of int into ArrayList in Java: "java.lang.ClassCastException: [I cannot be cast to java.lang.Integer" Hot Network Questions …

  10. Converting from int array to Integer arraylist in java

    Nov 8, 2015 · It is recommended to use the interface List for members/variables and use the ArrayList constructor. Also ArrayList without the brackets indicates the raw type instead of …

Refresh