Amigo, it seems you may now have an adequate foundation. It's time to test your skills by doing a big task!
Today, we'll implement our own tree in a slightly non-standard way (based on AbstractList).
To get background information, use your favorite search engine and the text below.
The nodes of the tree should be like those in the picture:
First, let's make our tree a descendant of the AbstractList class with a String parameter, and we'll implement the Cloneable and Serializable interfaces.
For now, leave the standard implementations of the get(int index) and size() methods.
Requirements:
The CustomTree class must support the Cloneable interface.
The CustomTree class must support the Serializable interface.
The CustomTree class must be a descendant of the AbstractList<String> class.
package com.codegym.task.task20.task2028.
import java.util.List;
public class Solution {
public static void main(String[] args) {
List<String> list = new CustomTree();
}
}
Like this we can't really see what's going on in your code. It's better if you use the "attach solution" option or copy the code and post it.
In the Conditions it says the CustomTree class is created based on AbstractList. So you need an abstractList field in your customTree class. In the get() an size() methods you can then perform actions on this list (use AbstractLists' standart implementations)
You can look for further information for the coming exercises here, for example. There are also some good youtube videos on this topic.
+1
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.