Conversation
| /// Size property | ||
| /// </summary> | ||
| /// <returns>Number of element on list</returns> | ||
| public int Size { get;} |
There was a problem hiding this comment.
| public int Size { get;} | |
| public int Size { get; } |
| /// Сlass representing a list | ||
| /// </summary> | ||
| /// <typeparam name="T"> type of item values in the list </typeparam> | ||
| abstract public class SinglyLinkedList<T> : IUniqueList<T> |
There was a problem hiding this comment.
Обычный список не обязан содержать уникальные элементы. Либо у Вас интерфейс неудачно назван, либо иерархия наследования сломана
|
|
||
| private ListElement? head; | ||
| private ListElement? tail; | ||
| public int Size { get; private set; } |
There was a problem hiding this comment.
По-хорошему public-свойствам тоже комментарии нужны
| return; | ||
| } | ||
|
|
||
| var newTail = new ListElement(){}; |
There was a problem hiding this comment.
| var newTail = new ListElement(){}; | |
| var newTail = new ListElement(); |
| } | ||
|
|
||
| var element = head; | ||
| var copyElement = new ListElement(); |
There was a problem hiding this comment.
Для удаления элемента как бы не надо выделять память на куче
| } | ||
|
|
||
| /// <summary> | ||
| /// Аunction to search for an item in the list |
There was a problem hiding this comment.
| /// Аunction to search for an item in the list | |
| /// Function to search for an item in the list |
| namespace List; | ||
|
|
||
| /// <summary> | ||
| /// A class for creating custom exceptions |
There was a problem hiding this comment.
Комментарий тут и ниже неправдив, надо поправить
| /// </summary> | ||
| public class RemoveNonExistingElementException : Exception | ||
| { | ||
| public RemoveNonExistingElementException() : base() { } |
There was a problem hiding this comment.
А пустой конструктор без параметров не нужен, он сам сгенерится
|
|
||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
Всё-таки можно нарушить инвариант уникальности в списке. Подумайте, как
|
|
||
| public class Tests | ||
| { | ||
| IUniqueList<int> list = new UniqueList<int>(); |
There was a problem hiding this comment.
| IUniqueList<int> list = new UniqueList<int>(); | |
| private IUniqueList<int> list = new UniqueList<int>(); |
No description provided.