public enum DuplicateStrategy extends Enum<DuplicateStrategy>
| 枚举常量和说明 |
|---|
ALERT
Throws an exception when the key already exists.
|
DISCARD
When the key already exists, discard the new value and old value, return null.
|
DISCARD_NEW
When the key already exists, discard the old key value.
|
DISCARD_OLD
When the key already exists, discard the new key value.
|
| 限定符和类型 | 方法和说明 |
|---|---|
<K,V> V |
choose(K key,
V oldVal,
V newVal)
Choose to return one of the old and new values.
|
static DuplicateStrategy |
valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static DuplicateStrategy[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static final DuplicateStrategy ALERT
IllegalArgumentExceptionpublic static final DuplicateStrategy DISCARD_NEW
public static final DuplicateStrategy DISCARD_OLD
public static final DuplicateStrategy DISCARD
public static DuplicateStrategy[] values()
for (DuplicateStrategy c : DuplicateStrategy.values()) System.out.println(c);
public static DuplicateStrategy valueOf(String name)
name - 要返回的枚举常量的名称。IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量NullPointerException - 如果参数为空值public <K,V> V choose(K key,
V oldVal,
V newVal)
key - keyoldVal - old valnewVal - new valCopyright © 2024. All rights reserved.