Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

 

Replace Vector elements using index example

With this example we are going to demonstrate how to replace Vector elements using index. The Vector API provides methods for such operations. In short, to replace elements in a Vector using index you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Invoke set(int index, E element) API method of Vector, ...

Read More »

Remove Vector element example

This is an example of how to remove an element from a Vector. We are using the remove(Object o) API method of Vector. Removing an element from a Vector implies that you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Remove an element from the Vector, using remove(Object o) API method. ...

Read More »

Remove Vector elements using index example

In this example we shall show you how to remove elements from a Vector using index. To remove an element from a Vector using index one should perform the following steps: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Remove an element from the Vector. Invoke remove(int index) API method of Vector, ...

Read More »

Remove all elements from Vector example

With this example we are going to demonstrate how to remove all elements from a Vector. We are using clear() API method of Vector. In short, to remove all elements from a Vector you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Invoke clear() API method of Vector. The method removes ...

Read More »

Vector ListIterator example

This is an example of how to obtain a Vector ListIterator. Obtaining a ListIterator of a Vector implies that you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Invoke listIterator() API method of Vector, to get the ListIterator. Use hasNext() and next() methods of ListIterator for forward iteration over the collection ...

Read More »

Vector Iterator example

In this example we shall show you how to obtain a Vector Iterator, in order to iterate through a Vector’s elements. To obtain a Vector Iterator one should perform the following steps: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Invoke iterator() API method of Vector, to get the Iterator. Iterate through ...

Read More »

Insert all elements of Collection to specific Vector index

With this example we are going to demonstrate how to insert all elements of a Collection to specific Vector index, using the ArrayList as a Collection implementation. In short, to insert all elements of an ArrayList to a specific Vector index you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Create ...

Read More »

Get sub list of Vector example

This is an example of how to get the sub list of a Vector. The Vector API provides the subList(int fromIndex, int toIndex) method. Getting a Vector sub list implies that you should: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Invoke subList(int fromIndex, int toIndex) method of Vector. The method returns ...

Read More »

Vector size example

In this example we shall show you how to get the Vector size, that is the number of elements that a Vector contains. To get the Vector size one should perform the following steps: Create a new Vector. Populate the vector with elements, with add(E e) API method of Vector. Get the Vector size, using size() API method of Vector. ...

Read More »

Convert Vector to Object array example

With this example we are going to demonstrate how to convert a Vector to an Object array. In order to convert a Vector to Object array we need to fill the array with all the elements in the vector in the correct order. In short, to convert a Vector to an object array you should: Create a new Vector. Populate ...

Read More »