We are using a software to take care of code quality and from which I saw today a finding saying that calling contains()
on an arraylist is inefficient. And the suggested way (supposably better) is to use HashSets.
So regarding to that software this:
boolean doesContain = (new HashSet<>(arrayList)).contains("something");
is more efficient that this:
boolean doesContain = arrayList.contains("something");
Can this actually be true, and if yes why?