Java ArrayList removeRange方法


Java ArrayList removeRange方法

package com.codingdict;

import java.util.*;

   public class ArrayListDemo extends ArrayList {
      public static void main(String[] args) {

      // create an empty array list
      ArrayListDemo arrlist = new ArrayListDemo();

      // use add() method to add values in the list
      arrlist.add(10);
      arrlist.add(12);
      arrlist.add(31);

      // print the list
      System.out.println("The list:" + arrlist);

      // removing range of 1st 2 elements
      arrlist.removeRange(0,2);
      System.out.println("The list after using removeRange:" + arrlist);
   }
}