Skip to content

Commit

Permalink
Adding add for utf8 and equals methods in String/Utf8/Charsequence Li…
Browse files Browse the repository at this point in the history
…stViews
  • Loading branch information
li-ukumar committed Jun 25, 2024
1 parent b0fc4f9 commit 0c58c07
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ public CharSequence next() {
}
};
}

@Override
public boolean equals(Object o) {
return o instanceof CharSequenceListView && utf8List.equals(((CharSequenceListView) o).utf8List);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,30 @@ public String set(int index, String element) {
return previousValue;
}

public String set(int index, Utf8 element) {
String previousValue = String.valueOf(_utf8List.get(index));
_utf8List.set(index, element);
return previousValue;
}

@Override
public void add(int index, String element) {
_utf8List.add(index, new Utf8(element));
}

public void add(int index, Utf8 element) {
_utf8List.add(index, element);
}

@Override
public boolean add(String element) {
return _utf8List.add(new Utf8(element));
}

public boolean add(Utf8 element) {
return _utf8List.add(element);
}

@Override
public boolean addAll(int index, java.util.Collection<? extends String> c) {
boolean modified = false;
Expand Down Expand Up @@ -84,4 +98,9 @@ public String next() {
}
};
}

@Override
public boolean equals(Object o) {
return o instanceof StringListView && _utf8List.equals(((StringListView) o)._utf8List);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ public void clear() {
public Iterator<Utf8> iterator() {
return utf8List.iterator();
}

@Override
public boolean equals(Object o) {
return o instanceof Utf8ListView && utf8List.equals(((Utf8ListView) o).utf8List);
}
}

0 comments on commit 0c58c07

Please sign in to comment.