- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVectorExample.java
More file actions
Latest commit
25 lines (22 loc) · 726 Bytes
/
Copy pathVectorExample.java
File metadata and controls
25 lines (22 loc) · 726 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
packagecollection.List;
importjava.util.Iterator;
importjava.util.Vector;
publicclassVectorExample {
publicstaticvoidmain(String[] args) {
Vector<String> list= newVector<>();
list.add("Java");
list.add("C");
list.add("C++");
list.add("HTML");
System.out.println("Element at index 2: "+list.get(2));
Iterator<String> itr=list.iterator();
while(itr.hasNext())
System.out.println(itr.next());
System.out.println("Removed Element: "+list.remove(2));
System.out.println("New Element at index 2: "+list.get(2));
System.out.println(list.parallelStream());
System.out.println(list.iterator());
list.set(2,"JavaScript");
System.out.println("Postion 2 Element Changed to "+list.get(2));
}
}