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

    Oct 1, 2008 · As of java 8, Collectors.toList() will return an ArrayList. However this may differ in future versions on java.If you want a specific type of collection then use …

  2. 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 …

  3. arraylist - How to use an array list in Java? - Stack Overflow

    References API: Java Collections Framework tutorial class ArrayList<E> implements List<E> interface List<E> E get(int index) Returns the element at the specified position in this list. Don't …

  4. Java ArrayList of ArrayList - Stack Overflow

    The instruction for new ArrayList(inner) creates a new ArrayList with the contents of inner inside of it - but doesn't use the same instance as inner. Thus, you'll retain the content, but not retain …

  5. java - How can I create an Array of ArrayLists? - Stack Overflow

    I am wanting to create an array of arraylist like below: ArrayList<Individual> [] group = new ArrayList<Individual> () [4]; But it's not compiling. How can I do this?

  6. 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 …

  7. 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 …

  8. ArrayList of int array in java - Stack Overflow

    May 7, 2012 · System.out.println("Arraylist contains: " + arl.toString()); If you want to access the i element, where i is an index from 0 to the length of the array-1, you can do a :

  9. 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:

  10. java - Polymorphism: Why use "List list = new ArrayList" instead of ...

    Mar 24, 2012 · A lot of people fail to mention it's perfectly acceptable to instantiate it as a local variable via ArrayList list = new ArrayList (). It's only really beneficial to use the List interface in …