Core Java® Volume I–Fundamentals


Chapter 8: Generic Programming



Download 37,53 Mb.
Pdf ko'rish
bet9/34
Sana06.01.2022
Hajmi37,53 Mb.
#325163
1   ...   5   6   7   8   9   10   11   12   ...   34
Bog'liq
9780134177373-Vol-1

415

Chapter 8: Generic Programming ..............................................................

416


Why Generic Programming? ..................................................................

8.1


416

The Advantage of Type Parameters .........................................

8.1.1

417


Who Wants to Be a Generic Programmer? .............................

8.1.2


418

Defining a Simple Generic Class ...........................................................

8.2

421


Generic Methods ......................................................................................

8.3


422

Bounds for Type Variables ......................................................................

8.4

425


Generic Code and the Virtual Machine ................................................

8.5


425

Type Erasure ..............................................................................

8.5.1

426


Translating Generic Expressions .............................................

8.5.2


427

Translating Generic Methods ..................................................

8.5.3

xi

Contents


From the Library of Hristo Dimov Hristov


ptg18360597

429


Calling Legacy Code .................................................................

8.5.4


430

Restrictions and Limitations ..................................................................

8.6

430


Type Parameters Cannot Be Instantiated with Primitive

Types ...........................................................................................

8.6.1

431


Runtime Type Inquiry Only Works with Raw Types ...........

8.6.2


431

You Cannot Create Arrays of Parameterized Types  ............

8.6.3

432


Varargs Warnings ......................................................................

8.6.4


433

You Cannot Instantiate Type Variables ..................................

8.6.5

434


You Cannot Construct a Generic Array .................................

8.6.6


436

Type Variables Are Not Valid in Static Contexts of Generic

Classes .........................................................................................

8.6.7


436

You Cannot Throw or Catch Instances of a Generic Class ...

8.6.8

437


You Can Defeat Checked Exception Checking .....................

8.6.9


439

Beware of Clashes after Erasure ..............................................

8.6.10

440


Inheritance Rules for Generic Types .....................................................

8.7


442

Wildcard Types ........................................................................................

8.8

442


The Wildcard Concept ..............................................................

8.8.1


444

Supertype Bounds for Wildcards ............................................

8.8.2

447


Unbounded Wildcards .............................................................

8.8.3


448

Wildcard Capture ......................................................................

8.8.4

450


Reflection and Generics ..........................................................................

8.9


450

The Generic 

Class

 Class ..............................................................



8.9.1

452


Using 

Class


 Parameters for Type Matching ........................

8.9.2


452

Generic Type Information in the Virtual Machine ................

8.9.3


Download 37,53 Mb.

Do'stlaringiz bilan baham:
1   ...   5   6   7   8   9   10   11   12   ...   34




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish