what difference between arraylist contains() method , set duplicate filtration , advantages of using that?
if have set, ensures cannot contain duplicate elements based on equals. using list, not automatically. have use
if(!list.contains(element)){ list.add(element); } see what difference between set , list?
as performance, depends on usage pattern. depends on operations frequently. anyway, if don't have special requirements make necessary optimize performance, use set since makes intention clearer.
Comments
Post a Comment