arraylist size or length code example
Example 1: php array length
count($myArray);
Example 2: arraylist length java
aList.size()
Example 3: js length of array
arr = ["a", "b", "c"];
len = arr.length;
Example 4: ArrayList size() method in java
import java.util.ArrayList;
public class ArrayListSizeMethodExample
{
public static void main(String[] args)
{
ArrayList<String> al = new ArrayList<String>();
int s = al.size();
System.out.println("size of ArrayList: " + s);
al.add("red");
al.add("blue");
al.add("green");
s = al.size();
System.out.println("size of ArrayList after adding elements: " + s);
al.clear();
s = al.size();
System.out.println("size of ArrayList after clearing elements: " + s);
}
}