-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListPractice.java
More file actions
32 lines (24 loc) · 833 Bytes
/
ListPractice.java
File metadata and controls
32 lines (24 loc) · 833 Bytes
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
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ListPractice {
public static void main(String[] args) {
List<String> listOfStrings = new ArrayList<>();
listOfStrings.add("sahith");
listOfStrings.add("mom");
listOfStrings.add("Dad");
listOfStrings.add("geethu");
for(String words:listOfStrings){
System.out.println(words);
}
Iterator<String> stringIterator = listOfStrings.iterator();
while(stringIterator.hasNext()){
if(stringIterator.next().endsWith("thu")){
stringIterator.remove();
}
}
System.out.println(listOfStrings);
int[] sample = {2,3,6,5,4,7,8,7};
System.out.println(sample.length);
}
}