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

    Oct 1, 2008 · List<Element> list = Arrays.asList(array); This will work fine. But some caveats: The list returned from asList has fixed size. So, if you want to be able to add or remove elements …

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

    Oct 28, 2010 · How might I convert an ArrayList<String> object to a String [] array in Java?

  3. java - How does ArrayList work? - Stack Overflow

    Aug 12, 2010 · ArrayList uses an Array of Object to store the data internally. When you initialize an ArrayList, an array of size 10 (default capacity) is created and an element added to the …

  4. java - How to declare an ArrayList with values? - Stack Overflow

    ArrayList or List declaration in Java has questioned and answered how to declare an empty ArrayList but how do I declare an ArrayList with values? I've tried the following but it returns a …

  5. java - Initialization of an ArrayList in one line - Stack Overflow

    Jun 17, 2009 · ArrayList<String> list = new ArrayList<String>() {{ add("A"); add("B"); add("C"); }}; However, I'm not too fond of that method because what you end up with is a subclass of …

  6. java - Creating an Arraylist of Objects - Stack Overflow

    How do I fill an ArrayList with objects, with each object inside being different?

  7. java - How to get the last value of an ArrayList - Stack Overflow

    5 If you can, swap out the ArrayList for an ArrayDeque, which has convenient methods like removeLast.

  8. java - How to sort a List/ArrayList? - Stack Overflow

    Apr 27, 2013 · I have a List of Double objects in Java. I want to sort the ArrayList in descending order. Input ArrayList:

  9. java howto ArrayList push, pop, shift, and unshift

    Nov 4, 2022 · I've determined that a Java ArrayList.add is similar to a JavaScript Array.push I'm stuck on finding ArrayList functions similar to the following Array.pop Array.shift Array.unshift …

  10. java - What are the differences between ArrayList and Vector?

    Jun 6, 2010 · What are the differences between the two data structures ArrayList and Vector, and where should you use each of them?