LinkedList.contains execution speed

Posted by Le_Coeur on Stack Overflow See other posts from Stack Overflow or by Le_Coeur
Published on 2010-05-10T16:07:19Z Indexed on 2010/05/10 16:14 UTC
Read the original article Hit count: 200

Filed under:
|

Why Methode LinkedList.contains() runs quickly than such implementation:

for (String s : list) 
   if (s.equals(element))
     return true;
return false;

I don't see great difference between this to implementations(i consider that search objects aren't nulls), same iterator and equals operation

© Stack Overflow or respective owner

Related posts about java

Related posts about algorithm