diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index 1e33d9446..fe198c8b2 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -940,10 +940,10 @@ public final class ChronicleMapBuilder implements Cloneable, * @see #prepareDefaultValueBytes(PrepareValueBytes) */ public ChronicleMapBuilder 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; } diff --git a/src/main/java/net/openhft/chronicle/map/NullValueProvider.java b/src/main/java/net/openhft/chronicle/map/NullValueProvider.java deleted file mode 100644 index 9e79889e8..000000000 --- a/src/main/java/net/openhft/chronicle/map/NullValueProvider.java +++ /dev/null @@ -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; - } -}