Hi Friends, can u give code to convert ArrayList to
HashMap and HashMap to ArrayList.
Answer / prashant
public class superClass {
public static void main(String[] args) {
ArrayList<String> strArrayList = new
ArrayList<String>();
strArrayList.add("Prashant");
strArrayList.add("Amol");
HashMap<Integer, String> hashMap = new
HashMap<Integer, String>();
for(int i = 0;i<strArrayList.size();i++){
hashMap.put(i, strArrayList.get(i));
}
System.out.println(hashMap);
}
}
Is This Answer Correct ? | 20 Yes | 4 No |
How many digits is int32?
What is member in java?
What are the application of stack?
Are arrays passed by reference in java?
What does this mean java?
What is busy spin, and why should you use it?
Create a form of user Login in JSP, that accepts the user name and password from user and authenticate it with user names and passwords stored in database. (Plz provide me answer immediately)
What is object-oriented paradigm?
What is nextint java?
What is an argument java?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
Can constructor be protected in java?