Q) I have a ArrayList object, in that object i have added 5
integer values, 5 float values, 5 string values. Now
question is how can delete particular type of data ( i.e all
int values or all float values or string values) in that
list object at a time?
Answer Posted / murli
for(int i=0;i<arr.size();i++){
if(arr.get(i) instanceof Integer)
arr.remove(i);
}
Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What is array initialization in java?
Why do we override tostring method in java?
Explain creating threads by implementing runnable class?
What is integers and example?
How is hashcode calculated in java?
What is navigable map in java?
Name few java 8 annotations ?
What are synchronized methods and synchronized statements in java programming?
why we use merge option in hybernate pls give a ex snippet
Is null function in java?
Can I import same package/class twice?
Is there any difference between synchronized methods and synchronized statements?
What is tcp ip in java?
There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread