chaokunyang commented on code in PR #2999:
URL: https://github.com/apache/fory/pull/2999#discussion_r2597353994


##########
java/fory-core/src/main/java/org/apache/fory/serializer/collection/CollectionSerializers.java:
##########
@@ -292,6 +293,53 @@ public CopyOnWriteArrayList onCollectionRead(Collection 
collection) {
       Object[] elements = ((CollectionContainer) collection).elements;
       return new CopyOnWriteArrayList(elements);
     }
+
+    @Override
+    public CopyOnWriteArrayList copy(CopyOnWriteArrayList originCollection) {
+      Preconditions.checkArgument(supportCodegenHook);
+      CopyOnWriteArrayList newCollection = new CopyOnWriteArrayList();
+      if (needToCopyRef) {
+        fory.reference(originCollection, newCollection);
+      }
+      List copyList = new ArrayList(originCollection.size());
+      copyElements(originCollection, copyList);
+      newCollection.addAll(copyList);
+      return newCollection;
+    }
+  }
+
+  public static class CopyOnWriteArraySetSerializer
+      extends ConcurrentCollectionSerializer<CopyOnWriteArraySet> {
+
+    public CopyOnWriteArraySetSerializer(Fory fory, Class<CopyOnWriteArraySet> 
type) {
+      super(fory, type, true);
+    }
+
+    @Override
+    public Collection newCollection(MemoryBuffer buffer) {
+      int numElements = buffer.readVarUint32Small7();
+      setNumElements(numElements);
+      return new CollectionContainer<>(numElements);
+    }
+
+    @Override
+    public CopyOnWriteArraySet onCollectionRead(Collection collection) {
+      Object[] elements = ((CollectionContainer) collection).elements;
+      return new CopyOnWriteArraySet(Arrays.asList(elements));
+    }
+
+    @Override
+    public CopyOnWriteArraySet copy(CopyOnWriteArraySet originCollection) {
+      Preconditions.checkArgument(supportCodegenHook);

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to