java_gen: add PrimitiveSinkUtils
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java
new file mode 100644
index 0000000..9a1401d
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java
@@ -0,0 +1,30 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+import java.util.SortedSet;
+
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+
+import com.google.common.hash.PrimitiveSink;
+
+/** Utility methods for dumping collections into primitive sinks.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public class PrimitiveSinkUtils {
+ private PrimitiveSinkUtils() {}
+
+ public static void putSortedSetTo(PrimitiveSink sink,
+ SortedSet<? extends PrimitiveSinkable> set) {
+ for(PrimitiveSinkable e: set) {
+ e.putTo(sink);
+ }
+ }
+
+ public static void putListTo(PrimitiveSink sink,
+ List<? extends PrimitiveSinkable> set) {
+ for(PrimitiveSinkable e: set) {
+ e.putTo(sink);
+ }
+ }
+}