🗊 Презентация Generics. (Lecture 7.3)

Нажмите для полного просмотра!
Generics. (Lecture 7.3), слайд №1 Generics. (Lecture 7.3), слайд №2 Generics. (Lecture 7.3), слайд №3 Generics. (Lecture 7.3), слайд №4 Generics. (Lecture 7.3), слайд №5 Generics. (Lecture 7.3), слайд №6 Generics. (Lecture 7.3), слайд №7 Generics. (Lecture 7.3), слайд №8 Generics. (Lecture 7.3), слайд №9 Generics. (Lecture 7.3), слайд №10 Generics. (Lecture 7.3), слайд №11 Generics. (Lecture 7.3), слайд №12 Generics. (Lecture 7.3), слайд №13 Generics. (Lecture 7.3), слайд №14 Generics. (Lecture 7.3), слайд №15 Generics. (Lecture 7.3), слайд №16 Generics. (Lecture 7.3), слайд №17 Generics. (Lecture 7.3), слайд №18 Generics. (Lecture 7.3), слайд №19 Generics. (Lecture 7.3), слайд №20 Generics. (Lecture 7.3), слайд №21 Generics. (Lecture 7.3), слайд №22 Generics. (Lecture 7.3), слайд №23 Generics. (Lecture 7.3), слайд №24 Generics. (Lecture 7.3), слайд №25 Generics. (Lecture 7.3), слайд №26 Generics. (Lecture 7.3), слайд №27 Generics. (Lecture 7.3), слайд №28 Generics. (Lecture 7.3), слайд №29 Generics. (Lecture 7.3), слайд №30 Generics. (Lecture 7.3), слайд №31 Generics. (Lecture 7.3), слайд №32 Generics. (Lecture 7.3), слайд №33 Generics. (Lecture 7.3), слайд №34 Generics. (Lecture 7.3), слайд №35 Generics. (Lecture 7.3), слайд №36 Generics. (Lecture 7.3), слайд №37 Generics. (Lecture 7.3), слайд №38 Generics. (Lecture 7.3), слайд №39 Generics. (Lecture 7.3), слайд №40 Generics. (Lecture 7.3), слайд №41 Generics. (Lecture 7.3), слайд №42

Вы можете ознакомиться и скачать презентацию на тему Generics. (Lecture 7.3). Доклад-сообщение содержит 42 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


Generics
Описание слайда:
Generics

Слайд 2


Generics. (Lecture 7.3), слайд №2
Описание слайда:

Слайд 3


Generics. (Lecture 7.3), слайд №3
Описание слайда:

Слайд 4


Generics. (Lecture 7.3), слайд №4
Описание слайда:

Слайд 5


Generics. (Lecture 7.3), слайд №5
Описание слайда:

Слайд 6


Generics. (Lecture 7.3), слайд №6
Описание слайда:

Слайд 7


Generic Types and Methods There can be: Generic classes Generic interfaces Generic methods Bounded generic types Generic wildcards
Описание слайда:
Generic Types and Methods There can be: Generic classes Generic interfaces Generic methods Bounded generic types Generic wildcards

Слайд 8


Generics. (Lecture 7.3), слайд №8
Описание слайда:

Слайд 9


Type erasure Java generics are implemented using type erasure. This means that any specific type information is erased when you compile your code.
Описание слайда:
Type erasure Java generics are implemented using type erasure. This means that any specific type information is erased when you compile your code.

Слайд 10


Generics. (Lecture 7.3), слайд №10
Описание слайда:

Слайд 11


Generics. (Lecture 7.3), слайд №11
Описание слайда:

Слайд 12


Generics. (Lecture 7.3), слайд №12
Описание слайда:

Слайд 13


Generics. (Lecture 7.3), слайд №13
Описание слайда:

Слайд 14


Generics. (Lecture 7.3), слайд №14
Описание слайда:

Слайд 15


Generics. (Lecture 7.3), слайд №15
Описание слайда:

Слайд 16


Generics. (Lecture 7.3), слайд №16
Описание слайда:

Слайд 17


Generics. (Lecture 7.3), слайд №17
Описание слайда:

Слайд 18


Generics. (Lecture 7.3), слайд №18
Описание слайда:

Слайд 19


Generics. (Lecture 7.3), слайд №19
Описание слайда:

Слайд 20


Generics. (Lecture 7.3), слайд №20
Описание слайда:

Слайд 21


Generics. (Lecture 7.3), слайд №21
Описание слайда:

Слайд 22


Generics. (Lecture 7.3), слайд №22
Описание слайда:

Слайд 23


Generics. (Lecture 7.3), слайд №23
Описание слайда:

Слайд 24


Why Polymorphism doesn’t work class Holder { T[] items; int num = 0; void add(T item) { this.items[num++] = item;} T[] get() { return items; } } ......
Описание слайда:
Why Polymorphism doesn’t work class Holder { T[] items; int num = 0; void add(T item) { this.items[num++] = item;} T[] get() { return items; } } ... Holder h = new Holder(); h.add(1); h.add(2); Holder reg = h; h.add(new Double(1.25)); Integer i3 = h.get()[2] So Double is a Number but Holder is not Holder

Слайд 25


But you can do this: This is how you can put different object types in parameterized Holder object: Holder h = new Holder(); h.add(1); h.add(2);...
Описание слайда:
But you can do this: This is how you can put different object types in parameterized Holder object: Holder h = new Holder(); h.add(1); h.add(2); h.add(new Double(1.25)); Number i3 = h.get()[2]

Слайд 26


Generics. (Lecture 7.3), слайд №26
Описание слайда:

Слайд 27


Generic Wildcards (?) The wildcard provides a polymorphic - like behavior for declaring generics. , an unbounded wildcard
Описание слайда:
Generic Wildcards (?) The wildcard provides a polymorphic - like behavior for declaring generics. , an unbounded wildcard

Слайд 28


Unbounded Wildcards The unbounded wildcard represents any data type, similar to the < T > syntax. public static void printList(List list) {...
Описание слайда:
Unbounded Wildcards The unbounded wildcard represents any data type, similar to the < T > syntax. public static void printList(List list) { for(Object x : list) { System.out.println(x.toString()); } } ... ArrayList keywords = new ArrayList(); kyewords.add(“generic”); printList(keywords); Use the ? in situations where you do not need a formal parameter type like < T >

Слайд 29


Be careful Holder h = new Holder(); h.add(new Object()); // compile time error h.add(new String()); // compile time error // one exception!...
Описание слайда:
Be careful Holder h = new Holder(); h.add(new Object()); // compile time error h.add(new String()); // compile time error // one exception! h.add(null); // null is member of every type Working with unbounded wildcards we can only read data, not assign!

Слайд 30


Upper - Bound Wildcards Bounded wildcards put some restrictions on unknown type: public static void printList(List
Описание слайда:
Upper - Bound Wildcards Bounded wildcards put some restrictions on unknown type: public static void printList(List

Слайд 31


Generics. (Lecture 7.3), слайд №31
Описание слайда:

Слайд 32


Lower Bounded Wildcards a lower bounded wildcard restricts the unknown type to be a specific type or a super type of that type Holder
Описание слайда:
Lower Bounded Wildcards a lower bounded wildcard restricts the unknown type to be a specific type or a super type of that type Holder

Слайд 33


Example public static void addNumbers(List
Описание слайда:
Example public static void addNumbers(List

Слайд 34


Generics. (Lecture 7.3), слайд №34
Описание слайда:

Слайд 35


Generics. (Lecture 7.3), слайд №35
Описание слайда:

Слайд 36


Generics. (Lecture 7.3), слайд №36
Описание слайда:

Слайд 37


Generics. (Lecture 7.3), слайд №37
Описание слайда:

Слайд 38


Generics. (Lecture 7.3), слайд №38
Описание слайда:

Слайд 39


Generics. (Lecture 7.3), слайд №39
Описание слайда:

Слайд 40


Naming Conventions for Generics E for an element K for a map key V for a map value N for a number T for a generic data type Use S , U , V , and so on...
Описание слайда:
Naming Conventions for Generics E for an element K for a map key V for a map value N for a number T for a generic data type Use S , U , V , and so on for multiple types in the same class.

Слайд 41


Generics. (Lecture 7.3), слайд №41
Описание слайда:

Слайд 42


Generics. (Lecture 7.3), слайд №42
Описание слайда:



Теги Generics Lecture
Похожие презентации
Mypresentation.ru
Загрузить презентацию