Top "Arraylist" questions

A simple collection data type found in some languages / platforms (such as in Java or .NET).

Java ArrayList copy

I have an ArrayList l1 of size 10. I assign l1 to new list reference type l2. Will l1 and l2 …

java arraylist
How to avoid java.util.ConcurrentModificationException when iterating through and removing elements from an ArrayList

I have an ArrayList that I want to iterate over. While iterating over it I have to remove elements at …

java arraylist foreach
Add object to ArrayList at specified index

I think it's a fairly simple question, but I can't figure out how to do this properly. I've got an …

java android arraylist
How to split() a delimited string to a List<String>

I had this code: String[] lineElements; . . . try { using (StreamReader sr = new StreamReader("TestFile.txt")) { String line; while ((line = sr.ReadLine()) != …

c# .net list arraylist
How to count the number of occurrences of an element in a List

I have an ArrayList, a Collection class of Java, as follows: ArrayList<String> animals = new ArrayList<String&…

java arraylist collections
Populating a ListView using an ArrayList?

My Android app needs to populate the ListView using the data from an ArrayList. I have trouble doing this. Can …

java android listview arraylist
What is the Simplest Way to Reverse an ArrayList?

What is the simplest way to reverse this ArrayList? ArrayList<Integer> aList = new ArrayList<>(); //Add elements …

java android arraylist collections
How to add an object to an ArrayList in Java

I want to add an object to an ArrayList, but each time I add a new object to an ArrayList …

java arraylist add
Java ArrayList how to add elements at the beginning

I need to add elements to an ArrayList queue whatever, but when I call the function to add an element, …

java arrays arraylist stack
How to quickly and conveniently create a one element arraylist

Is there a Utility method somewhere that can do this in 1 line? I can't find it anywhere in Collections, or …

java arraylist collections