File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
src/DGenericContainer/List_ArrayList Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ public static void main(String[] args) {
1818
1919 public static void basicUse (){
2020 ArrayList <String > arrayList =new ArrayList <String >();
21- arrayList .add ("https://cs.supremepole.com/ " );
22- arrayList .add ("https://algorithm.supremepole.com/ " );
23- arrayList .add ("https://interview.supremepole.com/ " );
21+ arrayList .add ("AAA " );
22+ arrayList .add ("BBB " );
23+ arrayList .add ("CCC " );
2424 arrayList .remove (1 );//删除第2个元素
2525 arrayList .get (0 );//访问第1个元素
2626 arrayList .set (0 ,"string0" );//第1个参数为索引位置,第2个参数为要修改的值
Original file line number Diff line number Diff line change 88/**
99 * @ClassName RemoveItem
1010 * @Description 移除ArrayList中的元素
11- * @Author yuzhihua
11+ * @Author CodeCoderCoding
1212 * @Date 2022/4/29 19:30
1313 * @Version 1.0.0
1414 **/
1515public class RemoveItem {
1616
1717 public static void main (String [] args ) {
1818 ArrayList <String > arrayList = new ArrayList <String >();
19- arrayList .add ("https://cs.supremepole.com/ " );
20- arrayList .add ("https://algorithm.supremepole.com/ " );
21- arrayList .add ("https://interview.supremepole.com/ " );
19+ arrayList .add ("AAA " );
20+ arrayList .add ("BBB " );
21+ arrayList .add ("CCC " );
2222 arrayList .add ("target" );
23- removeWithFor (arrayList , "target" );
23+ removeWithCopyOnWrite (arrayList , "target" );
2424 }
2525
2626 /*
You can’t perform that action at this time.
0 commit comments