Difference between Java Collection Framework and C++ Collection Framework
Verified
Added on 2023/01/17
|4
|747
|51
AI Summary
This document discusses the differences between Java Collection Framework and C++ Collection Framework. It also explains how JCF represents Lists, Sets, and Maps, and covers sorting in the collection framework. Additionally, it explores the benefits and drawbacks of different collection frameworks.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head: JAVA PROGRAMMING JAVA PROGRAMMING Name of the Student Name of the University Author Note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
JAVA PROGRAMMING1 1.Difference between java collection framework and C++ collection framework: SL no. Java collection frameworkC++ collection framework 1.All of the algorithms have been organised by the containers. Thealgorithmsarehaving independencyforthe containersonthattheycan operate. 2.This function is does not exist in java collection framework. It includes the performance as oneofthepartsofthe requirements for the interface. 3.Java heavily relies on the interfaces.Itcannotrelyonthe interfaces. 4.Thecontainersareabletocontainonlythe algorithmsandtheobjectsthathavetobe separately defined for the containers as well as for the arrays. Thecontainersareableto contain either primitive type objects or the only the objects aswellasmanyofthe algorithmsforoperatingon eitherarraysoronthe containers. 5.These factors are not available in java collection framework. Themodelofthememory allocationisapartofthis frameworkaswellasthe programmes need to aware of the memory that is considered as deallocating. 6.Thepassingfunctionsarenotallowsas parameter. Thepassingfunctionsae allows as parameter. 2.How does JCF represent Lists, Sets, and Maps? The collection interface of java is an interface that is general and includes the sub interfaces that are List, sets and maps. If one of the method is having a type of parameter that is Collection, like theaddALL (collection coll)method. It can be passed as a set or list and that will work fine. The list is considered as an interface however, the ArrayList is the typically used class that is able to implement the Lists. On the other side the interface that is related to
2JAVA PROGRAMMING the map is different from the collection interface. A value or key dictionary is defined by the map interface however Hashmap is one of the most commonly used map. 3.Sorting in collection framework? The collection class is a method that is static in type for the sort of the elements that are included in the collection. If the elements of the collection are ofSetin type, then theTreeSet can be used. However, the elements that are included in the List cannot be sorted. The method for sorting of the elements that are included inList type elements,is provided by the Collection Class, The method: public void sort(List list):is utilized for sorting the elements that are included in List.The elements of the List have to beComparablein type. 4.Benefits and drawbacks of different collection framework: Benefits: The programmers require to learn the multiple ad hoc collection APIs. An interface that is standard for the collections are provided by this, that are reutilized by the fosters software as well as provides also the algorithms too for manipulating them. The data structures that are useful are provided, also it provides the algorithms that can reduce the effort for the programming. Drawbacks: This cannot be done the compile time checking type. It has to cast for correct type.
3JAVA PROGRAMMING Bibliography: Manotas, I., Pollock, L. and Clause, J., 2014, May. SEEDS: a software engineer's energy- optimizationdecisionsupportframework.InProceedingsofthe36thInternational Conference on Software Engineering(pp. 503-514). ACM. Ortiz, C.N., International Business Machines Corp, 2013.Automatic collection of diagnostic traces in an automation framework. U.S. Patent 8,359,581. Ortiz, C.N., International Business Machines Corp, 2013.Automatic collection of diagnostic traces in an automation framework. U.S. Patent 8,359,581. Pereira, R., Couto, M., Saraiva, J., Cunha, J. and Fernandes, J.P., 2016, May. The influence of the Java collection framework on overall energy consumption. InProceedings of the 5th International Workshop on Green and Sustainable Software(pp. 15-21). ACM.