we know that String Class is Fix class , that is complex to edit, add to it and remove from it , and if you need to do advence process like sort or search , then it will take good number of code.
but in jave there is class called Collections it can reduce that effort ..
here is some simple examples of how to use that class to manipulate String easily
import java.util.*; // <- this must be included
public class TheMain {
public static void main(String[] args) {
///
System.out.println("\n");
// names
String Names[] =
{"Programmer1","Hamad","Samer","Rami","Fahd","Abdullah","Saad","Omar" };
List list; // <- this is our new class
// print the String
System.out.print("The String Names: ");
for(int i = 0; i < Names.length; i ++)
{System.out.print(" "+Names);}
// copy String to list
list = new ArrayList(Arrays.asList(Names));
// print the List
System.out.println("The List list: "+ list);
//sort the list (Increment sorting)
Collections.sort(list);
System.out.println("The List After sort: "+list);
// rearrange the list randomly
Collections.shuffle(list);
System.out.println("The List After shuffle: "+list);
//find the max and min
System.out.println("\tThe Max Name is: "+Collections.max(list));
//find the Min and min
System.out.println("\tThe Min Name is: "+Collections.min(list));
// search
System.out.println("The Index of \"Samer\" in list is: "+Collections.binarySearch(list,"Samer"));
System.out.println("The Index of \"Programmer1\" in list is: "+Collections.binarySearch(list,"Programmer1"));
System.out.print("The Index of \"Ahmed\" in list is: "+Collections.binarySearch(list,"Ahmed"));
System.out.println(" if index = -ve 'then not in list' ");
//insert
list.add(2,"Ahmed");
System.out.println("The List After adding 'Ahmed' in the 2nd index: "+list);
// remove
list.remove(4);
System.out.println("The List After removing 4th index: "+list);
// return back to String
Names = (String[]) list.toArray(new String[list.size()]);
System.out.print("The String Names: ");
for(int i = 0; i < Names.length; i ++)
{System.out.print(" "+Names);}
///
}//end the main method
}// end TheMain classand if any question... Just Aske