gpt4 book ai didi

Java retainAll() 不工作?

转载 作者:行者123 更新时间:2023-11-29 06:36:05 27 4
gpt4 key购买 nike

<分区>

假设我有两个数组列表。

    a.add("Isabella");
a.add("Angelina");
a.add("Pille");
a.add("Hazem");

b.add("Isabella");
b.add("Angelina");
b.add("Bianca");

a.retainAll(b);

这应该为我提供包含以下元素的 Arraylist a:Isabella、Angelina、Pille、Hazem。但是,当我尝试 a.size() 时,我得到 0。为什么?

我的输出:

[DEBUG] The Karate Kid
[DEBUG] The Day the Earth Stood Still
[DEBUG] The Pursuit of Happyness
[DEBUG] Justin Bieber: Never Say Never
[DEBUG] After Earth

[DEBUG] Independence Day
[DEBUG] Men in Black
[DEBUG] Men in Black II
[DEBUG] Hancock
[DEBUG] Shark Tale
[DEBUG] Made in America
[DEBUG] Six Degrees of Separation
[DEBUG] Jersey Girl
[DEBUG] The Legend of Bagger Vance
[DEBUG] Men in Black 3
[DEBUG] Seven Pounds
[DEBUG] Bad Boys II
[DEBUG] Bad Boys 3
[DEBUG] Enemy of the State
[DEBUG] Wild Wild West
[DEBUG] Hitch
[DEBUG] Ali
[DEBUG] I, Robot
[DEBUG] Live 8
[DEBUG] Where The Day Takes You
[DEBUG] Independence Day 3
[DEBUG] I, Robot 2
[DEBUG] The Pursuit of Happyness
[DEBUG] I Am Legend
[DEBUG] Independence Day 2
[DEBUG] After Earth
[DEBUG] Bad Boys
[DEBUG] Partners in Time: The Making of MIB 3
[DEBUG] David Blaine: Real or Magic

[DEBUG] Size: 0

第一部是贾登史密斯主演的电影,第二部是威尔史密斯主演的电影,我只想要两者兼有的电影。 retainAll() 是这种工作的最佳方法吗?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com