denis-chudov commented on code in PR #5092: URL: https://github.com/apache/ignite-3/pull/5092#discussion_r1960126807
########## modules/core/src/main/java/org/apache/ignite/internal/util/io/IgniteDataOutput.java: ########## @@ -234,4 +236,43 @@ public interface IgniteDataOutput extends DataOutput { * @throws IOException if something went wrong */ void flush() throws IOException; + + /** + * Writes a collection. + * + * @param collection Collection. + * @param elementWriter Element writer. + */ + default <T> void writeCollection(Collection<T> collection, ObjectWriter<T> elementWriter) throws IOException { + writeVarInt(collection.size()); + + for (T e : collection) { + elementWriter.write(e, this); + } + } + + /** + * Writes a map. + * + * @param map Map. + * @param keyWriter Key writer. + * @param valWriter Value writer. + */ + default <K, V> void writeMap(Map<K, V> map, ObjectWriter<K> keyWriter, ObjectWriter<V> valWriter) + throws IOException { + writeVarInt(map.size()); + + for (Map.Entry<K, V> e : map.entrySet()) { + keyWriter.write(e.getKey(), this); + valWriter.write(e.getValue(), this); + } + } + + /**' Review Comment: wow -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org