diff --git a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/CharSequenceListView.java b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/CharSequenceListView.java index 000c7dfb..5ed126e9 100644 --- a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/CharSequenceListView.java +++ b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/CharSequenceListView.java @@ -6,6 +6,7 @@ package com.linkedin.avroutil1.compatibility.collectiontransformer; import java.util.AbstractList; +import java.util.Iterator; import org.apache.avro.util.Utf8; @@ -60,4 +61,26 @@ public boolean addAll(int index, java.util.Collection c) public boolean remove(Object o) { return utf8List.remove(new Utf8(o.toString())); } + + @Override + public void clear() { + utf8List.clear(); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private final Iterator iter = utf8List.iterator(); + + @Override + public boolean hasNext() { + return iter.hasNext(); + } + + @Override + public CharSequence next() { + return String.valueOf(iter.next()); + } + }; + } } diff --git a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/StringListView.java b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/StringListView.java index 8fba353f..3a21a385 100644 --- a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/StringListView.java +++ b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/StringListView.java @@ -6,6 +6,7 @@ package com.linkedin.avroutil1.compatibility.collectiontransformer; import java.util.AbstractList; +import java.util.Iterator; import org.apache.avro.util.Utf8; @@ -61,4 +62,26 @@ public boolean addAll(int index, java.util.Collection c) { public boolean remove(Object o) { return _utf8List.remove(new Utf8(o.toString())); } + + @Override + public void clear() { + _utf8List.clear(); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private final Iterator _iter = _utf8List.iterator(); + + @Override + public boolean hasNext() { + return _iter.hasNext(); + } + + @Override + public String next() { + return String.valueOf(_iter.next()); + } + }; + } } diff --git a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/Utf8ListView.java b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/Utf8ListView.java index c3724f6b..d3097fc6 100644 --- a/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/Utf8ListView.java +++ b/helper/helper/src/main/java/com/linkedin/avroutil1/compatibility/collectiontransformer/Utf8ListView.java @@ -6,6 +6,7 @@ package com.linkedin.avroutil1.compatibility.collectiontransformer; import java.util.AbstractList; +import java.util.Iterator; import org.apache.avro.util.Utf8; @@ -55,4 +56,14 @@ public boolean addAll(int index, java.util.Collection c) { public boolean remove(Object o) { return utf8List.remove(o); } + + @Override + public void clear() { + utf8List.clear(); + } + + @Override + public Iterator iterator() { + return utf8List.iterator(); + } }