ChronicleMapBuilder.defaultValue() shouldn't be null because ChronicleMap generally doesn't support neither null key nor null values

This commit is contained in:
leventov
2014-12-15 22:49:53 +07:00
parent afb223be67
commit 4a54633577
2 changed files with 2 additions and 30 deletions
@@ -940,10 +940,10 @@ public final class ChronicleMapBuilder<K, V> implements Cloneable,
* @see #prepareDefaultValueBytes(PrepareValueBytes)
*/
public ChronicleMapBuilder<K, V> defaultValue(V defaultValue) {
if (defaultValue == null)
throw new IllegalArgumentException("default ChronicleMap value couldn't be null");
this.defaultValue = defaultValue;
this.defaultValueProvider = null;
if (defaultValue == null)
defaultValueProvider = NullValueProvider.INSTANCE;
this.prepareValueBytes = null;
return this;
}
@@ -1,28 +0,0 @@
/*
* Copyright 2014 Higher Frequency Trading
*
* http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.map;
enum NullValueProvider implements DefaultValueProvider {
INSTANCE;
@Override
public Object get(Object key) {
return null;
}
}