how to make arraylist of fixed size
List<Integer> arr = Arrays.asList(new Integer[10]);
how to make arraylist of fixed size
List<Integer> arr = Arrays.asList(new Integer[10]);
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);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us