-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCRUD.java
More file actions
48 lines (43 loc) · 1.02 KB
/
CRUD.java
File metadata and controls
48 lines (43 loc) · 1.02 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
import java.util.ArrayList;
import java.util.Collections;
public class CRUD {
public static void main(String[] args) {
Integer a = new Integer(100);
Integer b = new Integer(200);
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(100);
list.add(0,9999);
list.add(200);
list.add(list.get(0) + list.get(1));
System.out.println(list.toString());
list.remove(0);
int index = list.indexOf(200);
//if(list.contains(200)){
if(index>=0){
list.remove(index);
System.out.println("Found...");
}
else
{
System.out.println("Not Found...");
}
list.set(0, 7878);
Collections.sort(list);
System.out.println(list);
Collections.binarySearch(list, 200);
/*list.add(a);
list.add(b);
int c = a.intValue() + b.intValue(); // UnBoxing
Integer d = new Integer(c); // Boxing
list.add(d);
*/
/*ArrayList list = new ArrayList();
list.add("ram");
int y = 100;
Integer x = new Integer (y); // Boxing
list.add(x);
Integer r = (Integer)list.get(0);
System.out.println(r);
*/
}
}