removerange arraylist java code example
Example: ArrayList removeRange(int fromIndex int toIndex) method in java
import java.util.ArrayList;
public class ArrayListRemoveRangeMethodExample extends ArrayList<Integer>
{
public static void main(String[] args)
{
ArrayListRemoveRangeMethodExample al = new ArrayListRemoveRangeMethodExample();
al.add(23);
al.add(38);
al.add(18);
al.add(62);
al.add(27);
al.add(95);
System.out.println("ArrayList before using removeRange method: " + al);
al.removeRange(0, 2);
System.out.println("ArrayList after using removeRange method: " + al);
}
}