Saturday, July 17, 2021

How to sort elements of vector object on particular column

Using sort() method on vector object we can sort elements of vector object.
For this purpose we need to create our own comparator.
Steps to follow
1. Create own Comparator class by implementing Comparator interface and define compare method.
2. use vector.sort() method and pass the object of your own Comparator implemented class.
3. finally you vector object will have sorted elements as per your compare() method defined.

Please go through the above video for more in details.


Sunday, July 4, 2021

Java Collection #20 | Using Vector Part-2

How to add custom object to Vector?
What is the requirement to be able to search an custom object from vector?
Why and how to override equals() method?

Java Collection #19 | Using Vector

How to use java.util.Vector
How it is different from java.util.ArrayList
Different ways to add or remove elements.