Apart from HashSet contains method , is contains method work in O(1) for ArrayList , Set , Queue etc .
hey @amankumar7017 ArrayList . contains () method requires O(n) time