Java Collection : Vector Class - Exercises and Solution


1. Write a Java program to create a vector to store integer elements

View Solution

2. Write a Java program to create a vector to store objects of a class

View Solution

3. Write a Java program to create a vector to store different types of objects

View Solution

4. Write a Java program to count the items of a Vector collection

View Solution

5. Write a Java program to remove all elements of Vector collection

View Solution

6. Write a Java program to create a clone of a Vector collection

View Solution

7. Write a Java program to insert an item into Vector collection at the specified index

View Solution

8. Write a Java program to replace an item into Vector collection at the specified index

View Solution

9. Write a Java program to remove a specified item from Vector collection

View Solution

10. Write a Java program to remove an item from Vector collection at the specified index

View Solution

11. Write a Java program to add elements of a Vector to other Vector collection

View Solution

12. Write a Java program to add elements of a vector to other vector collection at the specified position

View Solution

13. Write a Java program to compare two Vector collections

View Solution

14. Write a Java program to check whether a Vector collection contains a specified item or not

View Solution

15. Write a Java program to copy elements of Vector collection into an array

View Solution

16. Write a Java program to get element from Vector collection at the specified index

View Solution

17. Write a Java program to get the Index of the first occurrence of the specified item in Vector collection

View Solution

18. Write a Java program to get the enumeration of the values present in the Vector

View Solution

19. Write a Java program to get elements from Vector collection based on an index

View Solution

20. Write a Java program to get the Index of the last occurrence of the specified item in Vector collection

View Solution

21. Write a Java program to check whether a Vector collection is empty or not

View Solution

22. Write a Java program to get the first element of Vector using the firstElement() method

View Solution

23. Write a Java program to get the last element of Vector using the lastElement() method

View Solution

24. Write a Java program to iterate Vector collection using the iterator() method

View Solution

25. Write a Java program to remove all elements of Vector collection contained in the specified collection

View Solution

26. Write a Java program to remove all elements of Vector collection using removeAllElements() method

View Solution

27. Write a Java program to remove the first occurrence of the specified element from Vector collection

View Solution

28. Write a Java program to remove an element from Vector collection based on the specified index

View Solution

29. Write a Java program to remove range on elements from Vector collection based on specified indices

View Solution

30. Write a Java program to remove elements from Vector collection based on a specified predicate

View Solution

31. Write a Java program to replace a specified element at all places with another element in Vector collection

View Solution

32. Write a Java program to remove all elements of Vector collection that do not contain in the specified collection

View Solution

33. Write a Java program to set an element at the specified index in Vector collection

View Solution

34. Write a Java program to change the size of a Vector collection

View Solution

35. Write a Java program to sort the elements of a Vector collection

View Solution

36. Write a Java program to traverse the Vector collection using spliterator() method

View Solution

37. Write a Java program to get the subList from the Vector collection

View Solution

38. Write a Java program to convert a Vector collection into an Object array

View Solution

39. Write a Java program to Accessing elements in a Vector

View Solution

40. Write a Java program to Iterating over a Vector using an enhanced for loop

View Solution



Basic Programs