Friday, 18 May 2012
 
29/08/10 03:18

Generics in the Java Programming Language (JDK)

Posted in Programming 
Posted by Adin
Sponsored Links

JDK1.5 introduces several extensions to the Java programming Language.One of these
is the introduction of generics.
Thistutorialisaimedatintroducingyou to generics.Youmaybefamiliarwith
similarconstructs from other languages, mostnotablyC++templates.Ifso,you’llsoon
seethatthere are bothsimilaritiesandimportantdifferences.Ifyouarenotfamiliar
withlook-a-alikeconstructsfromelsewhere,allthebetter;youcanstartafresh,without
unlearninganymisconceptions.
Genericsallowyoutoabstractovertypes. The most commonexamplesarecon-
tainertypes,suchasthoseintheCollectionhierarchy.
Hereisatypicalusageofthatsor

Contents
1Introduction2
2De?ningSimpleGenerics3
3GenericsandSubtyping4
4Wildcards5
4.1BoundedWildcards………………………6
5GenericMethods7
6InteroperatingwithLegacyCode10
6.1UsingLegacyCodeinGenericCode………………10
6.2ErasureandTranslation…………………….12
6.3UsingGenericCodeinLegacyCode………………13
7TheFinePrint14
7.1AGenericClassisSharedbyallitsInvocations…………14
7.2CastsandInstanceOf……………………..14
7.3Arrays…………………………….15
8ClassLiteralsasRun-timeTypeTokens16
9MoreFunwithWildcards18
9.1WildcardCapture……………………….20
10ConvertingLegacyCodetoUseGenerics20
11Acknowledgements23

DOWNLOAD


Sponsored Links
Users
eXTReMe Tracker

Get free news here
 

Copyright © 2012 Free Manual Document Format Files. All trademarks are the property of the respective trademark owners.
Resources Resources Blogs Software blogs Resources blogs