About 50 results
Open links in new tab
  1. 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 use raw types …

  2. java.util.ArrayList$Itr.checkForComodification exception thrown

    As you are itterating over a list and trying to remove element from the same list, a ConcurrentModificationException shall occur. You first iterate over the list then ...

  3. How to Resolve "java.util.Collections$SingletonList cannot be cast to ...

    Mar 18, 2024 · Why would you even want to make sortedList an ArrayList? If a function requires a parameter to be an ArrayList, I would suspect that that function needs refactoring as it probably …

  4. How to avoid java.util.ConcurrentModificationException when iterating ...

    Nov 12, 2011 · I have an ArrayList that I want to iterate over. While iterating over it I have to remove elements at the same time. Obviously this throws a java.util.ConcurrentModificationException. What …

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

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

  7. java - why HashMap Values are not cast in List? - Stack Overflow

    Going further into the Java API source code HashMap#values (): Check the return type in the source, and ask yourself, can a java.util.Collection be casted into java.util.ArrayList?

  8. Receiving Java Error - ArrayList$SubList cannot be cast to class

    Jun 9, 2021 · The subList() method returns an object of the nested static class ArrayList.SubList. You are trying to cast it to ArrayList, although they are not related by inheritance, so ArrayList.Sublist can …

  9. how to fix groovy.lang.MissingMethodException: No signature of …

    how to fix groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.get () is applicable for argument types: () values: [] Asked 6 years, 3 months ago Modified 1 month ago …

  10. Why doesn't the rangeCheck method in the java.util.ArrayList class ...

    Feb 28, 2022 · The range check on the array access checks if the array index is in the range 0 <= index < elementData.length. For a java.util.ArrayList the valid range of indexes is only 0 <= index < size, …