Is it possible to add a string to beginning of String array without iterating the entire array.
You can do some thing like below
public class Test {
public static String[] addFirst(String s[], String e) {
String[] temp = new String[s.length + 1];
temp[0] = e;
System.arraycopy(s, 0, temp, 1, s.length);
return temp;
}
public static void main(String[] args) {
String[] s = { "b", "c" };
s = addFirst(s, "a");
System.out.println(Arrays.toString(s));
}
}