belliottsmith commented on code in PR #1962:
URL: https://github.com/apache/cassandra/pull/1962#discussion_r1040117215
##########
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:
(I agree we shouldn’t simply invoke the collection variant)
--
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]