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 the use of object and class classes?
How do you input a string in java?
Which is a valid identifier?
What is meant by stack and queue?
Is int a class in java?
How can you write a loop indefinitely in java programming?
What is string and example?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
What is the difference between a field variable and a local variable?
Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?
What is strings in java?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
Is string a class in java?
What is java util?
Can an integer be a string?