How to override the debug variable format in Intellij Idea's debug window when inheriting a container (Vector)

Viewed 80

I have a class ValueList<K, V> that extends Vector<V> and adds bunch of other attributes to it. The declaration of the class is:

public class ValueList<K extends Comparable<K>, V> extends Vector<V> implements Comparable<ValueList<K, V>>

When debugging, Intellij's debug window has the format of ValueList the same as Vector, not showing the attributes that I added. For example: I have an array of ValueLists called valueLists, that's how its contents look like:

enter image description here

Also, I have already overridden toString() to print the elements of the Vector. What I know is that when I override toString(), Intellij prints the object using it on the side, and this is not happening.

Edit: the implementation of toString():

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("(");
    for (V v : this) {
        builder.append(v).append(", ");
    }
    return builder.append(")").toString();
}
1 Answers
Related