I'm a professional writer and Business Development with more than 10 years of experience. I have worked for a lot of businesses and can share sample works with you upon request. Chat me up and let's get started.
Here are a couple of similarities between ArrayList and HashSet in Java:
1) Both ArrayList and HashSet have not synchronized collection classes and not meant to be used in multi-threading and concurrent environments. You can make ArrayList and HashSet synchronized by using Collections.synchroinzedCollection() just like we make ArrayList and HashSet read-only another day.
2) The ArrayList and the HashSet both can be traversed using Iterator. This is, in fact, a preferred way if you want to perform an operation on all elements.
3) An iterator of ArrayList and HashSet both are fail-fast, i.e. they will throw ConcurrentModificationException if ArrayList or HashSet is modified structurally once Iterator has been created.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Here are a couple of similarities between ArrayList and HashSet in Java:
1) Both ArrayList and HashSet have not synchronized collection classes and not meant to be used in multi-threading and concurrent environments. You can make ArrayList and HashSet synchronized by using Collections.synchroinzedCollection() just like we make ArrayList and HashSet read-only another day.
2) The ArrayList and the HashSet both can be traversed using Iterator. This is, in fact, a preferred way if you want to perform an operation on all elements.
3) An iterator of ArrayList and HashSet both are fail-fast, i.e. they will throw ConcurrentModificationException if ArrayList or HashSet is modified structurally once Iterator has been created.