how to search the pertical objects in a Collections

Answers were Sorted based on User's Feedback



how to search the pertical objects in a Collections..

Answer / raj

We can search by contains(Object) method of collection
class. like
Arraylist list = new ArrayList();
list.add("a");
list.add("b");
if(list.contains("a")
{
--
--
}

Is This Answer Correct ?    2 Yes 0 No

how to search the pertical objects in a Collections..

Answer / manas

corrected of #1 ans:
ArrayList a1=new ArrayList();
a1.add("shiva");
Object e[]=a1.toArray();
for(int i=0;i<a1.size();i++)
{
if(e[i].equals("inputstring");
}
}

Is This Answer Correct ?    2 Yes 0 No

how to search the pertical objects in a Collections..

Answer / siva thimmannagari

ArrayList a1=new ArrayList();
a1.add("shiva");
Object e[]=a1.toArray();
for(int i=0;i<a1.size();i++0
{
if(e[0].equals("inputstring");
}
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Advanced Java Interview Questions

Which are the different segments of memory?

0 Answers  


What is the lifecycle of an applet?

2 Answers  


What state does a thread enter when it terminates its processing?

0 Answers  


What is Stream and Types?

2 Answers   Patni,


what are JSP tags? what is difference between include action and directory?

0 Answers   ADP,






When is the best time to validate input?

0 Answers  


1) what is synchronization? 2)write a program to show synchronization ? 3) what is orm? 4) what is getTemplete method and hw u use it? 5)write a singleton program ? 6) what is IOC concept & explain it? 7) methods of spring? 8)explain spring framework? 9)what are the oops concept? 10)what r the diff types of exception? 11)what is AOP(assepct oriented programing)? 12)jsp life cycle? 13)servlet life cycle? 14)how to u catch ur exception when executing a query in hibernate? 15)write javascript function? 16)write a querry to join two tables? 17)wap to show inheritance and use of interface? 18)explain the project? 19)in spring bean class uses singleton or prototype? 20)Explain prototype?

1 Answers   Cap Gemini,


In connection pool,when 100 clients are requesting, in pool 100 objects is there, when another client is making request how it will work

3 Answers  


What will happens, when a thread cannot acquire a lock on an object?

2 Answers  


What is deadlock?

2 Answers  


How will you pass parameters in RMI? Why do you serialize?

0 Answers  


What is difference between object state and behavior?

0 Answers  


Categories