About 24,100 results
Open links in new tab
  1. 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 …

  2. How a java iterator works internally? - Stack Overflow

    Mar 17, 2016 · The iterator for most simple java collections just keeps a pointer of where in the collection the iterator is currently at. Calling .next() will advance the iterator. It doesn't copy the …

  3. java - ArrayList: how does the size increase? - Stack Overflow

    java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.lang.Object. If reflections do not work for you (i.e. when using dataField.setAccessible(true)), one option is to …

  4. How are ArrayLists implemented in Java? - Stack Overflow

    An ArrayList extends AbstractList and implements four interfaces viz. List<E>, RandomAccess, Cloneable, java.io.Serializable. And it stores elements in an Object[] array as: private transient …

  5. java - How does a ArrayList's contains() method evaluate objects ...

    Say I create one object and add it to my ArrayList. If I then create another object with exactly the same constructor input, will the contains() method evaluate the two objects to be the same? …

  6. I want to know how list.add () works internally at runtime in Java

    Aug 2, 2018 · I want to know how list.add works internally. if the "new" keyword is used for each element to create an instance. If not, I wonder if Integer.valueOf is being used. To summarize, …

  7. java - How ArrayList contains method work? - Stack Overflow

    Sep 20, 2013 · Your idea of testing is correct, as contains internally uses equals to find the element, so if the string is matched using equals then it should return true. But it seems you …

  8. java - How does memory allocation of an ArrayList work ... - Stack …

    As far as I know, when we are creating an ArrayList: ArrayList<String> list = new ArrayList<String>(SIZE); The JVM reserves for it a contiguous part of memory. When we are …

  9. How array works internally in Java? - Stack Overflow

    Sep 27, 2014 · Internally, the memory for the object c is initialised to the correct values by the runtime. However, you don't have access to this behavior: you cannot call it directly or change …

  10. java - How Comparator internally works with ArrayList? (How to …

    Jun 5, 2018 · That violates the general contract; Java, in many cases, expects to be able to compare the elements in either order. Better to use Integer.compare(int, int) and return the …

Refresh