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 bits are in a sentence?
Why doesn't the java library use a randomized version of quicksort?
What is a marker interface?
What is meant by Encapsulation? Can you write a class to explain encapsulation?
What defines function?
How will you reverse a singly-link list?
0 Answers Akamai Technologies,
Can u write constructor in abstract.If yes den when it will be invoked.
Which class represents the socket that both the client and server use to communicate with each other?
What happens when heap memory is full?
What is the difference between a synchronized method and a synchronized block?
What is meant by object?
What is string :: npos?