Custom List от Java Advanced - Generics
Здравейте,
Имам проблем със задача Custom List от Java Advanced - Generics ! Последния тест ми гърми каквото и да променям и да опитвам!
Моля, ако някой може да помогне!
https://pastebin.com/UCjkX0qx
https://pastebin.com/Up1qfAQw
Problem 7. Custom List
Create a generic data structure that can store any type that can be compared. Implement functions:
void add(T element)
T remove(int index)
boolean contains(T element)
void swap(int index, int index)
int countGreaterThan(T element)
T getMax()
T getMin()
Create a command interpreter that reads commands and modifies the custom list that you have created. Implement
the commands:
Add {element} - Adds the given element to the end of the list.
Remove {index} - Removes the element at the given index.
Contains {element} - Prints if the list contains the given element (true or false).
Swap {index1} {index2} - Swaps the elements at the given indexes.
Greater {element} - Counts the elements that are greater than the given element and prints their count
Max - Prints the maximum element in the list.
Min - Prints the minimum element in the list.
Print - Prints all elements in the list, each on a separate line.
END - stops the reading of commands.
Note: For the Judge tests, use String as T.
Examples
Input Output Input Output
Add aa
Add bb
Add cc
Max
Min
Greater aa
Swap 0 2
Contains aa
Print
END
cc
aa
2
true
cc
bb
aa