How can I create a java.sql.Array of Strings?
Possible Duplicate:
How to create ArrayList (ArrayList<T>) from array (T[]) in Java
I have:
String[] time = {"22:22:22","22:22:23"};
Array asd = null;
How can I put something like asd=time ?
I assume that what you actually need is a java.sql.Array , since you mention jdbc and setArray in some of your comments.
Three options:
Connection.createArrayOf() . This might or might not be available, depending on the JDBC driver you are using. java.sql.Array . Here is an example for PostgreSQL. The Array class is not an actual array. Instead it is a helper class that has static methods to help with arrays.
You may be looking to use ArrayList or something like it. You could use it using List<String> asd = Arrays.asList(time)
Array is an interface, not a class. Are you referring to ArrayList ?!
Here is your answer: Create ArrayList from array
new ArrayList<Element>(Arrays.asList(array))
