maedhroz commented on code in PR #1962:
URL: https://github.com/apache/cassandra/pull/1962#discussion_r1040114254


##########
src/java/org/apache/cassandra/utils/CollectionSerializers.java:
##########
@@ -19,41 +19,43 @@
 package org.apache.cassandra.utils;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.util.RandomAccess;
 import java.util.Set;
 import java.util.function.IntFunction;
 
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
-import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.io.util.DataOutputPlus;
 
-public class CollectionSerializer
+import static com.google.common.primitives.Ints.checkedCast;
+import static org.apache.cassandra.db.TypeSizes.sizeofUnsignedVInt;
+
+public class CollectionSerializers
 {
 
-    public static <V> void serializeCollection(IVersionedSerializer<V> 
valueSerializer, Collection<V> values, DataOutputPlus out, int version) throws 
IOException
+    public static <V> void serializeCollection(Collection<V> values, 
DataOutputPlus out, int version, IVersionedSerializer<V> valueSerializer) 
throws IOException
     {
         out.writeUnsignedVInt(values.size());
         for (V value : values)
             valueSerializer.serialize(value, out, version);
     }
 
-    public static <V, L extends List<V> & RandomAccess> void 
serializeList(IVersionedSerializer<V> valueSerializer, L values, DataOutputPlus 
out, int version) throws IOException

Review Comment:
   In practice, it looks like this is always going to be an `ArrayList` anyway, 
but @belliottsmith was being cautious. I still don't think I'd delegate to 
`serializeCollection()`, given the clear intent to avoid creating iterators?
   
   @aweisberg Any opinion on this? I think this was part of your collection 
serializers patch I pulled in to make rebasing easier for you...



-- 
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