Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d15d423

Browse files
authored
Update 01_Using_the_Methods_of_Collection.md
1 parent 593b150 commit d15d423

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎ch12/01_Using_the_Methods_of_Collection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ assert tuesdayPhoneTasks.toString().equals("[phone Paul]");
178178
这个例子提供了对这个组和下一个方法的签名的解释。我们已经讨论过(第 `2.6` 节),当添加到集合中的方法将它们的参数限制为它的参数类型时,他们为什么会接受
179179
`Object``Collection<?>` 类型的参数。以 `retainAll` 为例,它的合同要求删除这个集合中不存在于参数集合中的那些元素。这没有理由限制论证集合可能包
180180
含的内容;在前面的示例中,它可以包含任何种类的任务的实例,而不仅仅是 `PhoneTask`。即使将参数限制为参数类型的超类型的集合也太狭窄了;我们希望可能的限制
181-
性最小的类型是 `Collection<?>。类似的推理适用于 `remove`,`removeAll`,`contains``containsAll`。
181+
性最小的类型是 `Collection<?>`。类似的推理适用于 `remove`,`removeAll`,`contains``containsAll`
182182

183183
**查询集合的内容**这些方法允许我们检查,例如,上述操作是否正常工作。我们将在这里使用断言来使系统检查我们的信念,即我们已经正确编程了以前的操作。例
184184
如,如果 `tuesdayPhoneTasks` 不包含 `paulPhone`,则第一条语句将抛出一个 `AssertionError`:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /