课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using the built-in linked list data structure in Java
- [Instructor] With an understanding of the LinkedList data structure, we can begin to work with LinkedLists in Java. In fact, we can use the built-in LinkedList type defined in the util package. We'll import java.util and the LinkedList class. To create a LinkedList, we'll write LinkedList and this will contain strings, so we'll put String in the arrow brackets. The LinkedList type is generic and it can hold many different types of data, including custom object data. All we have to do is specify it upon the list creation. We could specify integer, double or custom type but for this example, we're using strings. Let's add some data to the LinkedList. We can add data at the front or the back of the link using addFirst or addLast. We also have the option to add data before or after specific nodes in the list. Let's use add and add a few strings to the list. These will be appended to the back of the list. Now that we have some data, we can look at some of the other built-in operations…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
What is a linked list?2 分钟 18 秒
-
(已锁定)
Using the built-in linked list data structure in Java4 分钟 16 秒
-
(已锁定)
Create a custom data structure for linked list algorithms3 分钟 32 秒
-
(已锁定)
Linked list algorithms: Delete back half of a linked list4 分钟
-
(已锁定)
Solution: Sum contents of a linked list1 分钟 36 秒
-
-
-
-
-