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.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Running head: JAVA PROGRAMMING
JAVA PROGRAMMING
Name of the Student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
JAVA PROGRAMMING 1
1. Difference between java collection framework and C++ collection framework:
SL
no.
Java collection framework C++ collection framework
1. All of the algorithms have been organised by the
containers.
The algorithms are having
independency for the
containers on that they can
operate.
2. This function is does not exist in java collection
framework.
It includes the performance as
one of the parts of the
requirements for the interface.
3. Java heavily relies on the interfaces. It cannot rely on the
interfaces.
4. The containers are able to contain only the
algorithms and the objects that have to be
separately defined for the containers as well as
for the arrays.
The containers are able to
contain either primitive type
objects or the only the objects
as well as many of the
algorithms for operating on
either arrays or on the
containers.
5. These factors are not available in java collection
framework.
The model of the memory
allocation is a part of this
framework as well as the
programmes need to aware of
the memory that is considered
as deallocating.
6. The passing functions are not allows as
parameter.
The passing functions ae
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 the addALL (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
Document Page
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 of Set in type, then the TreeSet
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 in List 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 be Comparable in 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.
Document Page
3JAVA PROGRAMMING
Bibliography:
Manotas, I., Pollock, L. and Clause, J., 2014, May. SEEDS: a software engineer's energy-
optimization decision support framework. In Proceedings of the 36th International
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. In Proceedings of the 5th
International Workshop on Green and Sustainable Software (pp. 15-21). ACM.
chevron_up_icon
1 out of 4
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]