Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
After completing this unit, you should be able to: To form linked data structures using references, self-referential classes and recursion, the type-wrapper classes that enable programs to process primitive data values as objects, to use autoboxing to convert a primitive value to an object of the corresponding type-wrapper class, to use auto-unboxing to convert an object of a type-wrapper class to a primitive value. | 17 Data Structures Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd ‘Will you walk a little faster?’ said a whiting to a snail, ‘There’s a porpoise close behind us, and he’s treading on my tail.’ Lewis Carroll There is always room at the top. Daniel Webster Push on—keep moving. Thomas Morton I’ll turn over a new leaf. Miguel de Cervantes OBJECTIVES In this chapter you will learn: To form linked data structures using references, self-referential classes and recursion. The type-wrapper classes that enable programs to process primitive data values as objects. To use autoboxing to convert a primitive value to an object of the corresponding type-wrapper class. To use auto-unboxing to convert an object of a type-wrapper class to a primitive value. To create and manipulate dynamic data structures, such as linked lists, queues, stacks and binary trees. Various important applications of linked data structures. How to create reusable data structures | 17 Data Structures Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd ‘Will you walk a little faster?’ said a whiting to a snail, ‘There’s a porpoise close behind us, and he’s treading on my tail.’ Lewis Carroll There is always room at the top. Daniel Webster Push on—keep moving. Thomas Morton I’ll turn over a new leaf. Miguel de Cervantes OBJECTIVES In this chapter you will learn: To form linked data structures using references, self-referential classes and recursion. The type-wrapper classes that enable programs to process primitive data values as objects. To use autoboxing to convert a primitive value to an object of the corresponding type-wrapper class. To use auto-unboxing to convert an object of a type-wrapper class to a primitive value. To create and manipulate dynamic data structures, such as linked lists, queues, stacks and binary trees. Various important applications of linked data structures. How to create reusable data structures with classes, inheritance and composition. 17.1 Introduction 17.2 Type-Wrapper Classes for Primitive Types 17.3 Autoboxing and Auto-Unboxing 17.4 Self-Referential Classes 17.5 Dynamic Memory Allocation 17.6 Linked Lists 17.7 Stacks 17.8 Queues 17.9 Trees 17.10 Wrap-Up 17.1 Introduction Dynamic data structures Linear data structures Linked lists Stacks Queues Binary trees 17.2 Type-Wrapper Classes for Primitive Types Type-wrapper classes In package java.lang Enable programmers to manipulate primitive-type values as objects Boolean, Byte, Character, Double, Float, Integer, Long and Short 17.3 Autoboxing and Auto-Unboxing Boxing conversion Converts a value of a primitive type to an object of the corresponding type-wrapper class Unboxing conversion Converts an object of a type-wrapper class to a value of the corresponding primitive type Java automatically performs these conversions (starting with Java SE 5) Called autoboxing and auto-unboxing .