CodeGym/Java kurs/Java-samlingar/Stor uppgift: Abstraktlista klass

Stor uppgift: Abstraktlista klass

Tillgängliga

"Hej, soldat!"

"Grattis till att du uppgraderat dina kunskaper. Vi behöver killar som är beredda att göra vad som helst."

"Jag är säker på att du fortfarande har många oavslutade uppgifter. Det är dags att avsluta några av dem!"

14
Uppgift
Java Collections,  nivålektion
Låst
Build a tree (part 1)
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.
14
Uppgift
Java Collections,  nivålektion
Låst
Build a tree (part 2)
Despite the fact that our tree descends from the AbstractList class, it is not a list in the traditional sense. In particular, we don't have access to methods that take an element's index as an argument. You need to override such methods and throw a new type of exception: UnsupportedOperationExcept
14
Uppgift
Java Collections,  nivålektion
Låst
Build a tree (part 3)
We've created a class that defines a tree. Now we need a class that defines the nodes of a tree: 1) In the CustomTree class, create a static inner generic class Entry<T> with the default access modifier. 2) Make this class support the Serializable interface.
28
Uppgift
Java Collections,  nivålektion
Låst
Build a tree (part 4)
Every tree starts with a root, so don't forget to add an Entry<String> field called root with the default access modifier to the CustomTree class. Initialize it in the CustomTree constructor. It's name (elementName) isn't important.
28
Uppgift
Java Collections,  nivålektion
Låst
Build a tree (part 5)
We can add elements to the tree. Now let's work on deleting them: Implement the remove(Object o) method, which will remove the tree node whose name was passed as an argument. The method must throw an UnsupportedOperationException if the argument is not a String.
Kommentarer
  • Populär
  • Ny
  • Gammal
Du måste vara inloggad för att lämna en kommentar
Den här sidan har inga kommentarer än