Skip to content

Conversation

@MinyazevR
Copy link
Owner

No description provided.

/// Size property
/// </summary>
/// <returns>Number of element on list</returns>
public int Size { get;}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обычный список не обязан содержать уникальные элементы. Либо у Вас интерфейс неудачно назван, либо иерархия наследования сломана


private ListElement? head;
private ListElement? tail;
public int Size { get; private set; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По-хорошему public-свойствам тоже комментарии нужны

return;
}

var newTail = new ListElement(){};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var newTail = new ListElement(){};
var newTail = new ListElement();

}

var element = head;
var copyElement = new ListElement();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для удаления элемента как бы не надо выделять память на куче

}

/// <summary>
/// Аunction to search for an item in the list

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// А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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Комментарий тут и ниже неправдив, надо поправить

/// </summary>
public class RemoveNonExistingElementException : Exception
{
public RemoveNonExistingElementException() : base() { }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А пустой конструктор без параметров не нужен, он сам сгенерится


return false;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё-таки можно нарушить инвариант уникальности в списке. Подумайте, как


public class Tests
{
IUniqueList<int> list = new UniqueList<int>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IUniqueList<int> list = new UniqueList<int>();
private IUniqueList<int> list = new UniqueList<int>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants