Ok my code looks like that.
I don't know exactly what Validator want from me. I don't know whether I can use linkedLists / arrayLists ? // line 13
For start I implemented add() size() and getParrent() method and I get 3 red from validator, then I implemented remove() because I thought maybe I must do it too.
I need a hint what's wrong, what I can do here and what I can't.
Now program correctly adding and removing elements from list (I think so). But maybe your eyes help me catch some mistakes!
package com.codegym.task.task20.task2028;
import java.util.List;
public class Solution {
public static void main(String[] args) {
CustomTree list = new CustomTree(new CustomTree.Entry<>("0"));
for (int i = 1; i < 16; i++) {
list.add(String.valueOf(i));
}
System.out.println("The list size is " + list.size());
System.out.println("The expected parent is 3. The actual parent is " + list.getParent("8"));
System.out.println("The expected parent is 9. The actual parent is " + list.getParent("20"));
System.out.println("The expected parent is 7. The actual parent is " + list.getParent("16"));
System.out.println("The expected parent is 14. The actual parent is " + list.getParent("30"));
System.out.println("The expected parent is 9. The actual parent is " + list.getParent("20"));
list.remove("3");
for (CustomTree.Entry<String> s :list.getList()) {
System.out.println(s);
}
}
}