博客
关于我
027ArrayList类
阅读量:198 次
发布时间:2019-02-28

本文共 2194 字,大约阅读时间需要 7 分钟。

ArrayList ?

ArrayList ? Java ????????????????????????????????????????????????????????

????

ArrayList ?????????????

  • ????????????? ArrayList?????? 50?
  • ???????????????????????????????????????????
  • ??????????? ArrayList?????????
  • ????????????????? ArrayList ??????

    ??

    ArrayList ????????????????

  • ??????? Count ???????????????
  • ???????? Capacity ????????????????
  • ?????isFixedSize ?????????????????
  • ?????isReadOnly ????????????????
  • ??????? get ?????????????
  • ???????????????????????????????

    ??

    ArrayList ?????????????????

  • ????????? wrapObject ???????? ArrayList ??
  • ?????add ????????????????
  • ???????addAll ????????????????????
  • ?????indexOf ?????????????????????
  • ???????clear ???????????????
  • ?????clone ?????? ArrayList ??????
  • ????????contains ???????????????????
  • ??????toArray ??????????????????
  • ???sort ????????????????
  • ?????reverse ????????????????
  • ?????????????????????????????????????

    ??

    ??????? ArrayList ????

    import java.util.ArrayList;public class ArrayListExample {    public static void displayResult(ArrayList
    list) { System.out.println("ArrayList"); System.out.println("\tCount: " + list.size()); System.out.println("\tCapacity: " + list.capacity()); System.out.println("\tValues:"); Object obj; for (obj = list.get(0); obj != null; obj = list.get(i++)) { System.out.println("\t\t" + obj); } System.out.println(); } public static void main(String[] args) { ArrayList
    myAL1 = new ArrayList<>(); myAL1.add("Hello "); myAL1.add("World"); myAL1.add("!"); displayResult(myAL1); System.out.println("----------------------"); ArrayList
    myAL2 = new ArrayList<>(myAL1); displayResult(myAL2); System.out.println("----------------------"); ArrayList
    myAL3 = new ArrayList<>(20); displayResult(myAL3); System.out.println("----------------------"); ArrayList
    myAL4 = new ArrayList<>(20).repeat("Hello", 4); displayResult(myAL4); System.out.println("----------------------"); System.out.read(); }}

    ?????????????? ArrayList ????????????????????????????????

    转载地址:http://vngn.baihongyu.com/

    你可能感兴趣的文章
    php 标准规范
    查看>>
    PHP 浮点型精度运算相关问题
    查看>>
    php 浮点型计算精度问题
    查看>>
    php 特定时间段统计,jpgraph某个时间段的数据统计
    查看>>
    php 生成csv mac下乱码
    查看>>
    php 生成证书 签名及验签
    查看>>
    php 的rsa加密与解密
    查看>>
    PHP 的标准输入与输出
    查看>>
    php 笔记 (早前的,很乱)
    查看>>
    PHP 第一天
    查看>>
    Redis使用量暴增,快速定位有哪些大key在作怪
    查看>>
    php 结课作业答案,北语201803考试批次《PHP》(结课作业)1.pdf
    查看>>
    PHP 统计数据功能 有感
    查看>>
    SpringBoot处理JSON数据
    查看>>
    Redis使用基本套路
    查看>>
    php 解决项目中多个自动加载冲突问题
    查看>>
    PHP 设置调试工具XDebug PHPStorm IDE
    查看>>
    php 身份证号检测
    查看>>
    PHP 输入输出流合集
    查看>>
    PHP 过滤器(Filter)
    查看>>