Skip to content

mkyong.com

  • Spring Boot
  • Java Virtual Threads
  • Contact
  1. Home /
  2. hashset

Tag: hashset

j
java January 21, 2010 2 min read by mkyong 8 comments

How to convert List to Set (ArrayList to HashSet)

Collection object has a constructor that accept a Collection object to initial the value. Since both Set and List are extend the Collection, the conversion is quite straightforward. It’s just pass a List into Set constructor or vice verse. Convert List to Set Set set = new HashSet(list); Convert Set to List List list = […]

Read more How to convert List to Set (ArrayList to HashSet)

Java and Spring tutorials since 2008. Every example is a complete, runnable file, compiled and run on a real machine before it goes out.

About This Site

  • About
  • Editorial Policy
  • Contact
  • Code License
  • Privacy Policy
  • Terms of Use

© 2026 mkyong.com — Powered by WordPress

RSS