From e2625f1a582927bef494da80ac67aec594f3859f Mon Sep 17 00:00:00 2001 From: Uttam Kumar Date: Fri, 12 Jul 2024 13:31:21 -0700 Subject: [PATCH] =?UTF-8?q?Utf8=20and=20String=20types=20supported=20in=20?= =?UTF-8?q?StringList=E2=88=9Aiew.addAll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collectiontransformer/StringListView.java | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) 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 f157be3b..965db29c 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 @@ -65,32 +65,12 @@ public boolean add(Utf8 element) { @Override public boolean addAll(int index, java.util.Collection c) { boolean modified = false; - for (String element : c) { - _utf8List.add(index++, new Utf8(element)); - modified = true; - } - return modified; - } - - /** - * Overloaded method to add all Utf8 elements of a collection at a specific index. - */ - public boolean addAll(int index, java.util.List c) { - boolean modified = false; - for (Utf8 element : c) { - _utf8List.add(index++, element); - modified = true; - } - return modified; - } - - /** - * Overloaded method to add all Utf8 elements of a set at a specific index. - */ - public boolean addAll(int index, java.util.Set c) { - boolean modified = false; - for (Utf8 element : c) { - _utf8List.add(index++, element); + for (Object element : c) { + if (element instanceof Utf8) { + _utf8List.add(index++, (Utf8) element); + } else { + _utf8List.add(index++, new Utf8(String.valueOf(element))); + } modified = true; } return modified;