Opening Hours :7AM to 9PM
import java.util.*;
class VectorAdd
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
}
}
class Main
{
public static void main(String aargs[])
{
VectorAdd d=new VectorAdd();
d.list();
}
}
import java.util.*;
class VectorAddIndex
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
al.add(2,2000);//it will insert 2 index element
System.out.println("The List Items Are "+al);
}
}
class Main
{
public static void main(String aargs[])
{
VectorAddIndex d=new VectorAddIndex();
d.list();
}
}
import java.util.*;
class VectorAddAll
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al1.add(20);
al1.add(30);
al1.add(40);
al1.add(10);
al1.add(70);
System.out.println("The List Items Are "+al1);
Vector<Integer> al2=new Vector<Integer>();
al2.addAll(al1);
System.out.println("The List Items Are "+al2);
}
}
class Main
{
public static void main(String aargs[])
{
VectorAddAll d=new VectorAddAll();
d.list();
}
}
import java.util.*;
class VectorClear
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al1.add(20);
al1.add(30);
al1.add(40);
al1.add(10);
al1.add(70);
System.out.println("The List Items Are "+al1);
al1.clear();
System.out.println("The List Items Are "+al1);
}
}
class Main
{
public static void main(String aargs[])
{
VectorClear d=new VectorClear();
d.list();
}
}
import java.util.*;
class VectorClone
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
Vector<Integer> al2;
al2=(Vector)al.clone();
System.out.println("After Cloning The List Items Are "+al2);
}
}
class Main
{
public static void main(String aargs[])
{
VectorClone d=new VectorClone();
d.list();
}
}
import java.util.*;
class VectorContains
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.contains(20));
}
}
class Main
{
public static void main(String args[])
{
VectorContains d=new VectorContains();
d.list();
}
}
import java.util.*;
class VectorGet
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.get(1));
}
}
class Main
{
public static void main(String aargs[])
{
VectorGet d=new VectorGet();
d.list();
}
}
import java.util.*;
class VectorIndexOf
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.indexOf(10));
}
}
class Main
{
public static void main(String aargs[])
{
VectorIndexOf d=new VectorIndexOf();
d.list();
}
}
import java.util.*;
class VectorIsEmpty
{
void list()
{
AVector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.isEmpty());
}
}
class Main
{
public static void main(String args[])
{
VectorIsEmpty d=new VectorIsEmpty();
d.list();
}
}
import java.util.*;
class VectorRemove
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
al.remove(2);
System.out.println("After Remove The List Items Are "+al);
}
}
class Main
{
public static void main(String args[])
{
VectorRemove d=new VectorRemove();
d.list();
}
}
import java.util.*;
class VectorSet
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
al.set(1,1000);
System.out.println("After Set The List Items Are "+al);
}
}
class Main
{
public static void main(String args[])
{
VectorSet d=new VectorSet();
d.list();
}
}
import java.util.*;
class VectorSize
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.size());
}
}
class Main
{
public static void main(String args[])
{
VectorSize d=new VectorSize();
d.list();
}
}
mport java.util.*;
class VectorToArray
{
void list()
{
Vector<Integer> al=new Vector<Integer>();
al.add(20);
al.add(30);
al.add(40);
al.add(10);
al.add(70);
System.out.println("The List Items Are "+al);
System.out.println(al.toArray());
}
}
class Main
{
public static void main(String aargs[])
{
VectorToArray d=new VectorToArray();
d.list();
}
}
Note:
For all the list intrface implemented classes 50% of current location on increased once default memory locations are filled with the element.
Example: Initially for an array list 10 momory locations are created. After storing 10th element 5 memory location will be added(10/2). after storing 15th element 7 memory locations will be added(15/2 or (10+5)/2).
An Vector class object is not synchronized that means multiple threads can work simultanusly on the same resource.