61B-11: Libraries, Abstract Classes, Packages
Contents
Java Libraries
Collections
Collections
is a package in Java that provides various utility classes for working with collections.
Tasks引入
3 tasks, given the text of a book:
- Create a list of all words in the book.
- Count the number of unique words.
- Keep track of the number of times that specific words are mentioned.
#1 way set
|
|
#2 way map
|
|
Python里面则是dict实现,咋一看似乎更好?但是?
Java9新特点:
Interfaces and Abstract Classes
More interface details:
- Can provide variables, but they are
public static final
. final
means the value can never change.- A class can implement multiple interfaces.
interface summary
abstract class intro
两者对比
Packages
A package is a namespace that organizes classes and interfaces.