The Interface and Class Hierarchy Diagram of Java Collections

1. Collection vs Collections

First of all, “Collection” and “Collections” are two different concepts. As you will see from the hierarchy diagram below, “Collection” is a root interface in the Collection hierarchy but “Collections” is a class which provide static methods to manipulate on some Collection types.

2. Class hierarchy of Collection

The following diagram demonstrates class hierarchy of Collection.

3. Class hierarchy of Map

Here is class hierarchy of Map.

4. Summary of classes

collection-summary

5. Code Example

The following is a simple example to illustrate some collection types:

List<String> a1 = new ArrayList<String>();
a1.add("Program");
a1.add("Creek");
a1.add("Java");
a1.add("Java");
System.out.println("ArrayList Elements");
System.out.print("\t" + a1 + "\n");
 
List<String> l1 = new LinkedList<String>();
l1.add("Program");
l1.add("Creek");
l1.add("Java");
l1.add("Java");
System.out.println("LinkedList Elements");
System.out.print("\t" + l1 + "\n");
 
Set<String> s1 = new HashSet<String>(); // or new TreeSet() will order the elements;
s1.add("Program");
s1.add("Creek");
s1.add("Java");
s1.add("Java");
s1.add("tutorial");
System.out.println("Set Elements");
System.out.print("\t" + s1 + "\n");
 
Map<String, String> m1 = new HashMap<String, String>(); // or new TreeMap() will order based on keys
m1.put("Windows", "2000");
m1.put("Windows", "XP");
m1.put("Language", "Java");
m1.put("Website", "programcreek.com");
System.out.println("Map Elements");
System.out.print("\t" + m1);

Output:

ArrayList Elements
	[Program, Creek, Java, Java]
LinkedList Elements
	[Program, Creek, Java, Java]
Set Elements
	[tutorial, Creek, Program, Java]
Map Elements
	{Windows=XP, Website=programcreek.com, Language=Java}

194 thoughts on “The Interface and Class Hierarchy Diagram of Java Collections”

  1. Jeelani Law Empire offers professional and diverse legal services with a user-friendly website that effectively communicates their expertise.
    website is professional, informative, and clearly outlines a wide range of legal services. With minor improvements in design and content clarity, it can become even more impactful.



  2. M.A Bhatti Law Associates

    stands out as a premier law firm in Karachi, offering comprehensive legal solutions across various sectors.
    Their holistic approach, combining deep legal expertise with
    Associates stands out as a premier law firm in Karachi, offering comprehensive legal solutions across various sectors. Their holistic approach, combining deep legal expertise with a commitment to client success, ensures effective and timely resolutions. The firm’s dedication to excellence and integrity makes them a trusted partner for both individual and corporate clients.”?

  3. M.A. Bhatti Law Associates stands as a beacon of legal excellence in Karachi, Pakistan, offering a comprehensive suite of legal services tailored to meet the diverse needs of its clientele. With a steadfast commitment to professionalism, integrity, and client satisfaction, the firm has cemented its reputation as a leading law firm in the region.
    https://mabhattilaw.com/

  4. Visit Jeelani Law Empire
    Law Empire is a distinguished law firm in Karachi, Pakistan, offering a comprehensive range of legal services. Their team of experienced attorneys specializes in family law, property disputes, criminal defense, and various other legal matters. The firm is committed to providing personalized attention and strategic representation to both individuals and businesses. Their dedication to client satisfaction and quality service has established them as a trusted legal partner in Karachi.

  5. When seeking legal assistance in Karachi, Pakistan, look no further than the esteemed Lawyers in Karachi Pakistan Renowned for their expertise and dedication, these legal professionals offer a comprehensive range of services to address your legal needs effectively. Whether you require representation in civil matters, guidance on corporate law issues, or advocacy in criminal cases, lawyers in Karachi, Pakistan, stand ready to provide personalized support tailored to your specific situation.

  6. Discover the benefits of using Reusable Period Product in Brampton, ON These eco-friendly alternatives to disposable menstrual products offer a sustainable and cost-effective solution for managing your menstrual cycle. Made from high-quality materials, reusable period products are designed to provide comfort, reliability, and long-term savings. Whether you prefer menstrual cups, cloth pads, or period underwear, Brampton offers a variety of options to meet your needs and support a greener lifestyle.

  7. A Chain Link Fence is a versatile and practical fencing option commonly used in residential, commercial, and industrial settings. It consists of interlocking metal links, forming a durable and transparent barrier.

  8. Each of our Belleville Used Cars undergoes a rigorous inspection process to ensure it meets our high standards for quality and reliability. We understand that peace of mind is essential when purchasing a pre-owned vehicle, which is why we go above and beyond to ensure that every car on our lot is in top condition.

  9. CBD Vape Canada is a popular method of consuming CBD, a non-psychoactive compound found in cannabis plants. Vaping CBD involves using an electronic device, also known as a vape pen or vaporizer, to inhale CBD vapor. This method is preferred by many people due to its fast onset time and ease of use.

  10. Pingback: sv388aduayam.com
  11. Pingback: login sv388
  12. Pingback: locksmiths
  13. Pingback: GlucoProven Review
  14. Pingback: Annica Skin Serum
  15. Pingback: Gluco Proven
  16. Pingback: high Bay Lights
  17. Pingback: view site…
  18. Pingback: Discuss
  19. Pingback: joker-123.co.com
  20. Pingback: Login dewibola
  21. Pingback: click here
  22. Pingback: collect gifts
  23. Pingback: company website
  24. Pingback: Blaux Heater 450w
  25. Pingback: teeth Whitening
  26. Pingback: Going Here
  27. Pingback: Stop Toothache
  28. Pingback: dental implant
  29. Pingback: anchor
  30. Pingback: Children's Teeth
  31. Pingback: Netcallvoip.com
  32. Pingback: Solar In Orlando
  33. Pingback: bookingcare.vn
  34. Pingback: small acts
  35. Pingback: st louis dentists
  36. Pingback: Military Care
  37. Pingback: ambbet
  38. Pingback: right wall color
  39. Pingback: Dental Plymouth mn
  40. Pingback: Dental treatment
  41. Pingback: Marianne Beaty
  42. Pingback: allbet
  43. Pingback: iphone
  44. Pingback: astutamme saamarin
  45. Pingback: Xtreme Keto Lean
  46. Pingback: quesnit.in
  47. Pingback: Web3 Gaming
  48. Pingback: mom
  49. Pingback: my company
  50. Pingback: free games
  51. Pingback: planet Earth
  52. Pingback: similar webpage
  53. Pingback: Read Even more
  54. Pingback: baby Teething toys
  55. Pingback: yourlisten.com
  56. Pingback: Sweetdate.Space
  57. Pingback: Treat Baby
  58. Pingback: artnames.info
  59. Pingback: sbobet88
  60. Pingback: fishnut.ca
  61. u missed the abstractinterface,such as abstractcollection,abstractset,abstractlist,Those are important in the hierarchy of java collection.

Leave a Comment