-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckSize.java
More file actions
31 lines (31 loc) · 824 Bytes
/
Copy pathCheckSize.java
File metadata and controls
31 lines (31 loc) · 824 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
import java.util.Vector; // import class
import java.util.List; // import interface
import java.util.*;
public class CheckSize
{
public static void main(String x[])
{
List l = new Vector(); // using upcasting to check the size of the vector
System.out.println("Check empty condition: "+l.isEmpty());
l.add(200);
int size = l.size();
System.out.println("The size of Vector is: "+size);
System.out.println("Check empty condition: "+l.isEmpty());
l.add(200);
// contain method
System.out.println("Check element is present or not: "+l.contains(200));
System.out.println(l);
Iterator ls = l.iterator();
while(ls.hasNext())
{
Object obj = ls.next();
System.out.println(obj);
}
Object obj[] = l.toArray();
System.out.println(obj);
for(Object o : obj)
{
System.out.println(o);
}
}
}