Sorting Vector Element using I18N
This Example shows you how to sort vector element using I18N. In the code given below we are sorting some elements using some rules.Methods used in this example are described below :
Vector.add() : Vector is like an array, it contains elements that can be accessed using an integer index. However, the size of a Vector can increase or decrease as needed to adjust adding and removing items after the Vector has been created. add() method is used to appends the Fixed element to the end of this Vector.
Collator.getInstance() : The Collator class prosecutes locale-sensitive String comparison. You use this class to build searching and sorting routines for natural language text. getInstance() method is used to create a instance of Collator class.
SortString.java
import java.text.*;
|
Output :
Sorted Name ...
|
Download code