Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Generics the Java Programming Language
Đang chuẩn bị liên kết để tải về tài liệu:
Generics the Java Programming Language
Phương Thảo
76
24
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
JDK 1.5 introduces several extensions to the Java programming language. One of these is the introduction of generics. This tutorial is aimed at introducing you to generics. You may be familiar with similar constructs from other languages, most notably C++ templates. If so, you’ll soon see that there are both similarities and important differences. If you are not familiar with look-a-alike constructs from elsewhere, all the better; you can start afresh, without unlearning any misconceptions. Generics allow you to abstract over types. The most common examples are container types, such as those in the Collection hierarchy | Generics in the Java Programming Language Gilad Bracha July 5 2004 Contents 1 Introduction 2 2 Defining Simple Generics 3 3 Generics and Subtyping 4 4 Wildcards 5 4.1 Bounded Wildcards. 6 5 Generic Methods 7 6 Interoperating with Legacy Code 10 6.1 Using Legacy Code in Generic Code . 10 6.2 Erasure and Translation . 12 6.3 Using Generic Code in Legacy Code. 13 7 The Fine Print 14 7.1 A Generic Class is Shared by all its Invocations. 14 7.2 Casts and InstanceOf . 14 7.3 Arrays . 15 8 Class Literals as Run-time Type Tokens 16 9 More Fun with Wildcards 18 9.1 Wildcard Capture. 20 10 Converting Legacy Code to Use Generics 20 11 Acknowledgements 23 1 1 Introduction JDK 1.5 introduces several extensions to the Java programming language. One of these is the introduction of generics. This tutorial is aimed at introducing you to generics. You may be familiar with similar constructs from other languages most notably C templates. If so you ll soon see that there are both similarities and important differences. If you are not familiar with look-a-alike constructs from elsewhere all the better you can start afresh without unlearning any misconceptions. Generics allow you to abstract over types. The most common examples are container types such as those in the Collection hierarchy. Here is a typical usage of that sort List mylntList new LinkedList 1 myIntList.add new lnteger 0 2 Integer x Integer myIntList.iteratorO.nextO 3 The cast on line 3 is slightly annoying. Typically the programmer knows what kind of data has been placed into a particular list. However the cast is essential. The compiler can only guarantee that an Object will be returned by the iterator. To ensure the assignment to a variable of type Integer is type safe the cast is required. Of course the cast not only introduces clutter. It also introduces the possibility of a run time error since the programmer might be mistaken. What if programmers could actually express their intent and mark a list as being .
TÀI LIỆU LIÊN QUAN
Bài giảng môn Lập trình hướng đối tượng - Chương 6: Lập trình Generics
Bài giảng Lập trình hướng đối tượng (Object Oriented Programming) - Chương 6: Lập trình Generics
The Generics Solution
Bài giảng Lập trình hướng đối tượng: Chương 6 - Châu Thị Bảo Hà
Generics
Generics in the Java Programming Language
Language Features of Java Generics
Programming in C# - Generics and Iterators
A Guide To Advanced Java - Generics
The C# Programming Language
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.