Clearly, using a simple loop method is more efficient than using any collection. A lot of developers use the first method, but it is inefficient. Pushing the array to another Collection type will require spin through all elements to read them in before doing anything with the collection type.
Read full article from How to Check if an Array Contains a Value in Java Efficiently?
No comments:
Post a Comment