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 |
Is java se open source?
What is difference between compatible and incompatible changes in serialization?
What is the purpose of void class?
what are the uses of Class class and what it returns? explain it with the example code.
what is difference between type 4 driver and type 1 driver?
2 Answers CMC, CTS, IBM, JK Technosoft, Napier Healthcare,
Can we override static methods in java?
java can provide security ,how can provide?
8 Answers Aspire, BNP Paribas, Genpact, IBM,
What is a resource leak ?
Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.
What is the difference between throw and throws in java?
Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).
What is unicode?