Generics What is Generics?


Designing Generic Matrix Classes



Download 1.18 Mb.
Page5/15
Date20.02.2022
Size1.18 Mb.
#58285
1   2   3   4   5   6   7   8   9   ...   15
Generics-new

Designing Generic Matrix Classes

Objective: This example gives a generic class for matrix arithmetic. This class implements matrix addition and multiplication common for all types of matrices.


GenericMatrix

UML Diagram

Source Code

Objective: This example gives two programs that utilize the GenericMatrix class for integer matrix arithmetic and rational matrix arithmetic.


Run

TestIntegerMatrix

IntegerMatrix

Run


TestRationalMatrix

RationalMatrix


Collections

Case Study: Evaluating Expressions

Stacks can be used to evaluate expressions.


Run

Evaluate Expression


Java Collection Framework hierarchy

A collection is a container object that represents a group of objects, often referred to as elements. The Java Collections Framework supports three types of collections, named sets, lists, and maps.


Download 1.18 Mb.

Share with your friends:
1   2   3   4   5   6   7   8   9   ...   15




The database is protected by copyright ©ininet.org 2024
send message

    Main page