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
Explain differences between collection api and stream api?
List down the methods and interfaces of collection class in java.
how to split string in java?
How to add menushortcut to menu item?
Is the empty set a singleton?
Is final static java?
What does null mean in java?
What is a java object and java application?
What is a container in a gui?
What is getclass () getname () in java?
What are the differences between include directive and include action?
how we can create packages in java?
What is number data type?
why would you use a synchronized block vs. Synchronized method? : Java thread
Does hashset allow duplicates in java?