Implementation In this assignment, you will have to write a quadruply-linked list-based partial implementation of the Li
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Implementation In this assignment, you will have to write a quadruply-linked list-based partial implementation of the Li
You may review the following LinkedList implementation as an example how a linked list is implemented in Java (you may not copy or re-use the code from there): https://developer.classpath.org/doc/jav ... ource.html Ultimately, you should implement your class from scratch. Also, you need to ensure the best possible performance for all the implemented operations. E.g., to access the 85th element of a 100-element list, one should not need to access more than six elements in addition to the requested one. Part 1 Implement the following public methods in your implementation of the List interface, called TenLinked List: 1. boolean add (E e) 2. void add (int index, E element) remove(int index) 3. E 4. E get(int index) 5. int size() clear() 6. void 7. String toString() (see Java API: AbstractCollection²) One public constructor should exist in your implementation: one that takes no parameters and creates an empty list when the class is instantiated. The class should use generics. The behaviour of the methods in your implementation should be equivalent to that of Java Standard Library's classes (e.g., Linked List; please refer to the class API online). For the methods of the interface that you do not need to implement, you may either leave them empty or throw an exception public type some UnneededMethod() { throw new Unsupported Operation Exception(); } Of course, you are free to implement any private or protected methods and classes as you see fit. However, the methods mentioned above (or the ones present in the List interface, or in the class' superclasses) are the only public methods your class should contain. Furthermore, your code should not have any side effects, such as printing to the console.