-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayList_Basics.java
More file actions
37 lines (27 loc) · 869 Bytes
/
Copy pathArrayList_Basics.java
File metadata and controls
37 lines (27 loc) · 869 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
33
34
35
36
37
import java.util.ArrayList;
import java.util.Scanner;
public class ArrayList_Basics {
static Scanner sn = new Scanner(System.in);
static void display(ArrayList<Integer> arrl) {
if (arrl.isEmpty())
return;
System.out.println("Array : " + arrl);
}
static boolean Search(ArrayList<Integer> arrl) {
if (arrl.isEmpty())
return false;
System.out.println("Enter the value to be searched : ");
int x = sn.nextInt();
return arrl.contains(x);
}
static void remove(ArrayList<Integer> arrl, int index) {
if (arrl.isEmpty())
return;
if (arrl.contains(arrl.get(index)))
arrl.remove(index);
else {
System.out.println("Confirm Input Element");
return;
}
}
}