1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.collections4.map;
18
19 import java.util.Collection;
20 import java.util.Map;
21
22 /**
23 * This class is used in TestCompositeMap. When testing serialization,
24 * the class has to be separate of TestCompositeMap, else the test
25 * class also has to be serialized.
26 */
27 final class EmptyMapMutator<K, V> implements CompositeMap.MapMutator<K, V> {
28 /** Serialization version */
29 private static final long serialVersionUID = -2729718980002476794L;
30
31 @Override
32 public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, final V value) {
33 return composited[0].put(key, value);
34 }
35
36 @Override
37 public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) {
38 composited[0].putAll(t);
39 }
40
41 @Override
42 public void resolveCollision(final CompositeMap<K, V> composite,
43 final Map<K, V> existing,
44 final Map<K, V> added,
45 final Collection<K> intersect) {
46 // Do nothing
47 }
48
49 }