Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
89f7adfd
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看板
提交
89f7adfd
编写于
10月 16, 2013
作者:
H
henryjen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8026768: java.util.Map.Entry comparingBy methods missing @since 1.8
Reviewed-by: dholmes
上级
06003126
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
20 deletion
+25
-20
src/share/classes/java/util/Map.java
src/share/classes/java/util/Map.java
+25
-20
未找到文件。
src/share/classes/java/util/Map.java
浏览文件 @
89f7adfd
...
...
@@ -465,6 +465,7 @@ public interface Map<K,V> {
* @param <V> the type of the map values
* @return a comparator that compares {@link Map.Entry} in natural order on key.
* @see Comparable
* @since 1.8
*/
public
static
<
K
extends
Comparable
<?
super
K
>,
V
>
Comparator
<
Map
.
Entry
<
K
,
V
>>
comparingByKey
()
{
return
(
Comparator
<
Map
.
Entry
<
K
,
V
>>
&
Serializable
)
...
...
@@ -481,6 +482,7 @@ public interface Map<K,V> {
* @param <V> the {@link Comparable} type of the map values
* @return a comparator that compares {@link Map.Entry} in natural order on value.
* @see Comparable
* @since 1.8
*/
public
static
<
K
,
V
extends
Comparable
<?
super
V
>>
Comparator
<
Map
.
Entry
<
K
,
V
>>
comparingByValue
()
{
return
(
Comparator
<
Map
.
Entry
<
K
,
V
>>
&
Serializable
)
...
...
@@ -498,6 +500,7 @@ public interface Map<K,V> {
* @param <V> the type of the map values
* @param cmp the key {@link Comparator}
* @return a comparator that compares {@link Map.Entry} by the key.
* @since 1.8
*/
public
static
<
K
,
V
>
Comparator
<
Map
.
Entry
<
K
,
V
>>
comparingByKey
(
Comparator
<?
super
K
>
cmp
)
{
Objects
.
requireNonNull
(
cmp
);
...
...
@@ -516,6 +519,7 @@ public interface Map<K,V> {
* @param <V> the type of the map values
* @param cmp the value {@link Comparator}
* @return a comparator that compares {@link Map.Entry} by the value.
* @since 1.8
*/
public
static
<
K
,
V
>
Comparator
<
Map
.
Entry
<
K
,
V
>>
comparingByValue
(
Comparator
<?
super
V
>
cmp
)
{
Objects
.
requireNonNull
(
cmp
);
...
...
@@ -558,26 +562,27 @@ public interface Map<K,V> {
// Defaultable methods
/**
* Returns the value to which the specified key is mapped,
* or {@code defaultValue} if this map contains no mapping
* for the key.
*
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties.
*
* @param key the key whose associated value is to be returned
* @param defaultValue the default mapping of the key
* @return the value to which the specified key is mapped, or
* {@code defaultValue} if this map contains no mapping for the key
* @throws ClassCastException if the key is of an inappropriate type for
* this map
* (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not permit null keys
* (<a href="Collection.html#optional-restrictions">optional</a>)
*/
* Returns the value to which the specified key is mapped,
* or {@code defaultValue} if this map contains no mapping
* for the key.
*
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties.
*
* @param key the key whose associated value is to be returned
* @param defaultValue the default mapping of the key
* @return the value to which the specified key is mapped, or
* {@code defaultValue} if this map contains no mapping for the key
* @throws ClassCastException if the key is of an inappropriate type for
* this map
* (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not permit null keys
* (<a href="Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default
V
getOrDefault
(
Object
key
,
V
defaultValue
)
{
V
v
;
return
(((
v
=
get
(
key
))
!=
null
)
||
containsKey
(
key
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录