Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
00de8680
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
00de8680
编写于
5月 31, 2013
作者:
P
psandoz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013649: HashMap spliterator tryAdvance() encounters remaining elements after forEachRemaining()
Reviewed-by: chegar
上级
a0143c83
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
9 deletion
+46
-9
src/share/classes/java/util/HashMap.java
src/share/classes/java/util/HashMap.java
+9
-3
src/share/classes/java/util/WeakHashMap.java
src/share/classes/java/util/WeakHashMap.java
+9
-6
test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
...il/Spliterator/SpliteratorTraversingAndSplittingTest.java
+28
-0
未找到文件。
src/share/classes/java/util/HashMap.java
浏览文件 @
00de8680
...
...
@@ -2701,8 +2701,10 @@ public class HashMap<K,V>
action
.
accept
(
m
.
nullKeyEntry
.
key
);
}
}
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
(
index
=
hi
))
{
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
Object
p
=
current
;
current
=
null
;
do
{
if
(
p
==
null
)
{
p
=
tab
[
i
++];
...
...
@@ -2815,8 +2817,10 @@ public class HashMap<K,V>
action
.
accept
(
m
.
nullKeyEntry
.
value
);
}
}
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
(
index
=
hi
))
{
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
Object
p
=
current
;
current
=
null
;
do
{
if
(
p
==
null
)
{
p
=
tab
[
i
++];
...
...
@@ -2928,8 +2932,10 @@ public class HashMap<K,V>
action
.
accept
(
m
.
nullKeyEntry
);
}
}
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
(
index
=
hi
))
{
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
Object
p
=
current
;
current
=
null
;
do
{
if
(
p
==
null
)
{
p
=
tab
[
i
++];
...
...
src/share/classes/java/util/WeakHashMap.java
浏览文件 @
00de8680
...
...
@@ -1100,9 +1100,10 @@ public class WeakHashMap<K,V>
}
else
mc
=
expectedModCount
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
hi
)
{
index
=
hi
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
WeakHashMap
.
Entry
<
K
,
V
>
p
=
current
;
current
=
null
;
// exhaust
do
{
if
(
p
==
null
)
p
=
tab
[
i
++];
...
...
@@ -1179,9 +1180,10 @@ public class WeakHashMap<K,V>
}
else
mc
=
expectedModCount
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
hi
)
{
index
=
hi
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
WeakHashMap
.
Entry
<
K
,
V
>
p
=
current
;
current
=
null
;
// exhaust
do
{
if
(
p
==
null
)
p
=
tab
[
i
++];
...
...
@@ -1256,9 +1258,10 @@ public class WeakHashMap<K,V>
}
else
mc
=
expectedModCount
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
i
<
hi
)
{
index
=
hi
;
if
(
tab
.
length
>=
hi
&&
(
i
=
index
)
>=
0
&&
(
i
<
(
index
=
hi
)
||
current
!=
null
))
{
WeakHashMap
.
Entry
<
K
,
V
>
p
=
current
;
current
=
null
;
// exhaust
do
{
if
(
p
==
null
)
p
=
tab
[
i
++];
...
...
test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
浏览文件 @
00de8680
...
...
@@ -128,6 +128,10 @@ public class SpliteratorTraversingAndSplittingTest {
void
addMap
(
Function
<
Map
<
T
,
T
>,
?
extends
Map
<
T
,
T
>>
m
)
{
String
description
=
"new "
+
m
.
apply
(
Collections
.<
T
,
T
>
emptyMap
()).
getClass
().
getName
();
addMap
(
m
,
description
);
}
void
addMap
(
Function
<
Map
<
T
,
T
>,
?
extends
Map
<
T
,
T
>>
m
,
String
description
)
{
add
(
description
+
".keySet().spliterator()"
,
()
->
m
.
apply
(
mExp
).
keySet
().
spliterator
());
add
(
description
+
".values().spliterator()"
,
()
->
m
.
apply
(
mExp
).
values
().
spliterator
());
add
(
description
+
".entrySet().spliterator()"
,
mExp
.
entrySet
(),
()
->
m
.
apply
(
mExp
).
entrySet
().
spliterator
());
...
...
@@ -399,12 +403,36 @@ public class SpliteratorTraversingAndSplittingTest {
db
.
addMap
(
HashMap:
:
new
);
db
.
addMap
(
m
->
{
// Create a Map ensuring that for large sizes
// buckets will contain 2 or more entries
HashMap
<
Integer
,
Integer
>
cm
=
new
HashMap
<>(
1
,
m
.
size
()
+
1
);
// Don't use putAll which inflates the table by
// m.size() * loadFactor, thus creating a very sparse
// map for 1000 entries defeating the purpose of this test,
// in addition it will cause the split until null test to fail
// because the number of valid splits is larger than the
// threshold
for
(
Map
.
Entry
<
Integer
,
Integer
>
e
:
m
.
entrySet
())
cm
.
put
(
e
.
getKey
(),
e
.
getValue
());
return
cm
;
},
"new java.util.HashMap(1, size + 1)"
);
db
.
addMap
(
LinkedHashMap:
:
new
);
db
.
addMap
(
IdentityHashMap:
:
new
);
db
.
addMap
(
WeakHashMap:
:
new
);
db
.
addMap
(
m
->
{
// Create a Map ensuring that for large sizes
// buckets will be consist of 2 or more entries
WeakHashMap
<
Integer
,
Integer
>
cm
=
new
WeakHashMap
<>(
1
,
m
.
size
()
+
1
);
for
(
Map
.
Entry
<
Integer
,
Integer
>
e
:
m
.
entrySet
())
cm
.
put
(
e
.
getKey
(),
e
.
getValue
());
return
cm
;
},
"new java.util.WeakHashMap(1, size + 1)"
);
// @@@ Descending maps etc
db
.
addMap
(
TreeMap:
:
new
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录