|
1 | 1 | /* Copyright (c) 2008-2025, Nathan Sweet |
2 | 2 | * All rights reserved. |
3 | | - * |
| 3 | + * |
4 | 4 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following |
5 | 5 | * conditions are met: |
6 | | - * |
| 6 | + * |
7 | 7 | * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
8 | 8 | * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following |
9 | 9 | * disclaimer in the documentation and/or other materials provided with the distribution. |
10 | 10 | * - Neither the name of Esoteric Software nor the names of its contributors may be used to endorse or promote products derived |
11 | 11 | * from this software without specific prior written permission. |
12 | | - * |
| 12 | + * |
13 | 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
14 | 14 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
15 | 15 | * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
@@ -855,18 +855,20 @@ private PriorityQueue createPriorityQueue (Class<? extends Collection> type, int |
855 | 855 |
|
856 | 856 | /** Serializer for {@link ConcurrentHashMap.KeySetView}. |
857 | 857 | * @author Andreas Bergander */ |
858 | | - public static class KeySetViewSerializer extends CollectionSerializer<ConcurrentHashMap.KeySetView> { |
859 | | - protected void writeHeader (Kryo kryo, Output output, ConcurrentHashMap.KeySetView set) { |
| 858 | + public static class KeySetViewSerializer extends Serializer<ConcurrentHashMap.KeySetView> { |
| 859 | + public void write (Kryo kryo, Output output, ConcurrentHashMap.KeySetView set) { |
860 | 860 | kryo.writeClassAndObject(output, set.getMap()); |
861 | 861 | kryo.writeClassAndObject(output, set.getMappedValue()); |
862 | 862 | } |
863 | 863 |
|
864 | | - protected ConcurrentHashMap.KeySetView create (Kryo kryo, Input input, Class<? extends ConcurrentHashMap.KeySetView> type, int size) { |
| 864 | + public ConcurrentHashMap.KeySetView read (Kryo kryo, Input input, Class<? extends ConcurrentHashMap.KeySetView> type) { |
865 | 865 | return createKeySetView((ConcurrentHashMap)kryo.readClassAndObject(input), kryo.readClassAndObject(input)); |
866 | 866 | } |
867 | 867 |
|
868 | | - protected ConcurrentHashMap.KeySetView createCopy (Kryo kryo, ConcurrentHashMap.KeySetView original) { |
869 | | - return createKeySetView(original.getMap(), original.getMappedValue()); |
| 868 | + public ConcurrentHashMap.KeySetView copy (Kryo kryo, ConcurrentHashMap.KeySetView original) { |
| 869 | + |
| 870 | + ConcurrentHashMap newMap = kryo.copy(original.getMap()); |
| 871 | + return newMap.keySet(kryo.copy(original.getMappedValue())); |
870 | 872 | } |
871 | 873 |
|
872 | 874 | private ConcurrentHashMap.KeySetView createKeySetView (ConcurrentHashMap map, Object mappedValue) { |
|
0 commit comments