读文章

0.如果是基本数据类型的话,在数组中就存储特定的值;如果是对象的话,在数组中就是存储对象的引用。

1.数组本身就是对象

再读文章

0.Arrays.sort(array);  Arrays.toString(array);(重写了toString方法)  Arrays.copyOf(array,length);(返回复制以后的数组,也可以复制二维数组)  Arrays.copyOfRange(array, start_index,end_index);

1.数组类并没有重写equals方法,但是Arrays类重写了equals方法。Arrays.equals(array1,array2);  Arrays.deepEquals(array1,array2);  Arrays.deepToString(array1,array2);

又读文章

0.

    ArrayList的size不定的根据:

    • When the internal array is filled, ArrayList creates a new array internally. The size of the new array is the size of the old array times 1.5 plus 1.
    • All the data is copied from the old array into the new one。
    • The old array is cleaned up by the garbage collector.

  indexOf();  get();  add();  contain();  set();(与add有区别)  clear();  asList();{ArrayList<Cat> catsList = new ArrayList<>(Arrays.asList(catsArray));(使用方法)}  toArray();

  size();  

1.未解决问题:ArrayList<Cat> cats = new ArrayList<>(); ArrayList<Cat> cats = new ArrayList<Cat>();两者区别

最后再读一篇

0.You cannot simultaneously iterate over a collection and change its elements.(不能同时迭代集合并更改其中的元素,包括插入,删除等操作)

要实现迭代时还要更改其中的内容,就要用到Iterator类

  • hasNext() - returns true or false, depending on whether there is a next item in the list, or we have already reached the last one.
  • next() - returns the next item in the list
  • remove() - removes an item from the list
Iterator<Cat> catIterator = cats.iterator();// Create an iterator
while(catIterator.hasNext()) {// As long as there are elements in the list Cat nextCat = catIterator.next();// Get the next element
System.out.println(nextCat);// Display it
}

关于remove()方法:remove() removes the last element returned by the iterator.

remove()方法的使用:

Iterator<Cat> catIterator = cats.iterator();// Create an iterator
while(catIterator.hasNext()) {// As long as there are elements in the list Cat nextCat = catIterator.next();// Get the next element
if (nextCat.name.equals("Lionel Messi")) {
catIterator.remove();// Delete the cat with the specified name
}
} System.out.println(cats);

CodeGym-17~20的更多相关文章

  1. js如何判断一组数字是否连续,得到一个临时数组[[3,4],[13,14,15],[17],[20],[22]];

    var arrange = function(arr){ var result = [], temp = []; arr.sort(function(source, dest){ return sou ...

  2. 基数排序的可复用实现(C++11/14/17/20)

    基数排序,是对整数类型的一种排序方法,有MSD (most significant digit)和LSD (least significant digit)两种.MSD将每个数按照高位分为若干个桶(按 ...

  3. tail -fn 1000 test.log | grep '关键字' 按照时间段 sed -n '/2014-12-17 16:17:20/,/2014-12-17 16:17:36/p' test.log /var/log/wtmp 该日志文件永久记录每个用户登录、注销及系统的启动、停机的事件

    Linux 6种日志查看方法,不会看日志会被鄙视的 2020-02-11阅读 7.3K0   作为一名后端程序员,和Linux打交道的地方很多,不会看Linux日志,非常容易受到来自同事和面试官的嘲讽 ...

  4. [C++]PAT乙级1009. 说反话 (17/20)

    /* 1009. 说反话 (20) 给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出. 输入格式: 测试输入包含一个测试用例, 在一行内给出总长度不超过80的字符串. 字符串由若干单词和若干 ...

  5. [C++]PAT乙级1003. 我要通过!(17/20)

    /* 1003. 我要通过!(20) “答案正确”是自动判题系统给出的最令人欢喜的回复.本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错 ...

  6. 在LaTeX里插入全页的pdf 分类: LaTex 2015-02-04 17:20 142人阅读 评论(0) 收藏

    要帮女友排版毕业论文,需要插入封面,省时省力的方法就是把学校给的Word封面保存成PDF然后插入到Latex文档中. 首先添加下面的宏: \usepackage[final]{pdfpages} 然后 ...

  7. c++ 字符串流 sstream(常用于格式转换) 分类: C/C++ 2014-11-08 17:20 150人阅读 评论(0) 收藏

    使用stringstream对象简化类型转换 C++标准库中的<sstream>提供了比ANSI C的<stdio.h>更高级的一些功能,即单纯性.类型安全和可扩展性.在本文中 ...

  8. ListView常用属性 (2012-01-12 17:20:27)

    比较特别的属性,通过设置这样的属性可以做出更加美观的列表.stackFromBottom——设置该属性之后你最新条目就会显示你列表的最下面,值为true和false,如android:stackFro ...

  9. 《Tsinghua os mooc》第17~20讲 同步互斥、信号量、管程、死锁

    第十七讲 同步互斥 进程并发执行 好处1:共享资源.比如:多个用户使用同一台计算机. 好处2:加速.I/O操作和CPU计算可以重叠(并行). 好处3:模块化. 将大程序分解成小程序.以编译为例,gcc ...

  10. 第8次Scrum会议(10/20)【欢迎来怼】

    一.小组信息 队名:欢迎来怼 小组成员 队长:田继平 成员:李圆圆,葛美义,王伟东,姜珊,邵朔,冉华 小组照片 二.开会信息 时间:2017/10/20 17:20~17:45,总计25min. 地点 ...

随机推荐

  1. HMS Core机器学习服务助力Zaful用户便捷购物

    Zaful是近年来发展良好的出海电商平台,主打快时尚.在洞察其用户有购买街头海报.生活中同款衣物的需求后,Zaful联合HMS Core机器学习服务打造拍照购物服务.用户拍照后可在预设的商品图片库中搜 ...

  2. opencv笔记-SimpleBlobDetector

    通用的 Blob 检测方法包括:Laplacian of Gaussian(LoG), Difference of Gaussian(DoG), Derterminant of Hessian(DoH ...

  3. Solution -「洛谷 P4198」楼房重建

    \(\mathcal{Description}\)   Link.   给定点集 \(\{P_n\}\),\(P_i=(i,h_i)\),\(m\) 次修改,每次修改某个 \(h_i\),在每次修改后 ...

  4. Solution -「CF 1586F」Defender of Childhood Dreams

    \(\mathcal{Description}\)   Link.   定义有向图 \(G=(V,E)\),\(|V|=n\),\(\lang u,v\rang \in E \Leftrightarr ...

  5. Solution -「AGC 026D」Histogram Coloring

    \(\mathcal{Description}\)   Link.   有 \(n\) 列下底对齐的方格纸排成一行,第 \(i\) 列有 \(h_i\) 个方格.将每个方格染成黑色或白色,求使得任意完 ...

  6. nginx负载均衡中利用redis解决session一致性问题

    关于session一致性的现象及原因不是本小作文的重点,可以另行找杜丽娘O(∩_∩)O哈哈~重点是利用redis集中存储共享session的实际操作. 一.业务场景:nginx/tomcat/redi ...

  7. pytest--mark基本使用(主要通过pytest.ini文件注册标签名,对用例进行标记分组)

    1.pytest中的mark介绍 mark主要用于在测试用例/测试类中给用例打标记(只能使用已注册的标记 名),实现测试分组功能,并能和其它插件配合设置测试方法执行顺序等.如下 图,现在需要只执行红色 ...

  8. java高版本下各种JNDI Bypass方法复现

    目录 0 前言 1 Java高版本JNDI绕过的源代码分析 1.1 思路一的源码分析 1.2 思路二的源码分析 2 基于本地工厂类的利用方法 2.1 org.apache.naming.factory ...

  9. 为什么在数据驱动的路上,AB 实验值得信赖?

    在线AB实验成为当今互联网公司中必不可少的数据驱动的工具,很多公司把自己的应用来做一次AB实验作为数据驱动的试金石. 文 | 松宝 来自 字节跳动数据平台团队增长平台 在线AB实验成为当今互联网公司中 ...

  10. Arava: 用 swing 写一个取色器

    备哥以前发我了一个小工具,TakeColor 取色器.来复刻一个吧. 分析一下:顶部是菜单,左侧框显示当前鼠标所在的颜色(下面显示当前坐标和颜色值,默认RGB),中间框显示鼠标周围区域,右侧显示取色的 ...