-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayList_Practice_JavaPoint.java
More file actions
80 lines (57 loc) · 1.88 KB
/
Copy pathArrayList_Practice_JavaPoint.java
File metadata and controls
80 lines (57 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.*;
public class ArrayList_Practice_JavaPoint {
public static void main(String[] args) {
// ArrayList<Integer>list=new ArrayList<Integer>();
// list.add(34);
// list.add(89);
// list.add(478);
// list.add(3);
ArrayList<String>list=new ArrayList<String>();
list.add("Kapil");
list.add("Onetrust");
list.add("lusy");
list.add("india");
list.add("sohail");
// list.add(4);
// for (Integer listx:list){
// System.out.println(listx);
// if(listx.equals(3)){
// System.out.println("false");
// }
//###############
//setters and getters
//get() will give the element at the Specified index
//ser() will give update the Element
// System.out.println(list.get(2));
// list.set(2,499);
// for (Integer listy:list){
// System.out.println(listy);
//Sorting is done through the Collections through the Static sort()
// Collections.sort(list);
// for (Integer listxy:list)
// {
// System.out.println(listxy);
//
// }
// Collections.sort(list);
// for (Integer listXY:list){
// System.out.println(listXY);
// }
//iterating through the remaining Ways
//through the Lamda operators
// list.forEach(a->{
// System.out.println(list);
// });
// list.forEach(a->{
// System.out.println(list);
// });
// Iterator itr= list.iterator();
// while(itr.hasNext()){
// System.out.println(itr.next());
//removing an Element if that particular element is found the List
// list.removeIf(str->str.contains("sohail"));
// System.out.println(list);
//isempty()
System.out.println(list.isEmpty());
}
}