Added bounds search on Linked List
This commit is contained in:
parent
9c1a5738ca
commit
bd5c546794
@ -46,7 +46,7 @@ namespace C_.Datastructures
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
//Check Range
|
//Check Range
|
||||||
if (i >= Count) throw new System.Exception("Error! Index out of Bounds");
|
if (i >= Count || i < 0) throw new System.Exception("Error! Index out of Bounds");
|
||||||
|
|
||||||
//Return Value
|
//Return Value
|
||||||
LinkedListNode<T>? node = Traverse(i);
|
LinkedListNode<T>? node = Traverse(i);
|
||||||
@ -56,7 +56,7 @@ namespace C_.Datastructures
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
//Check Range
|
//Check Range
|
||||||
if (i >= Count) throw new System.Exception("Error! Index out of Bounds");
|
if (i >= Count || i < 0 ) throw new System.Exception("Error! Index out of Bounds");
|
||||||
|
|
||||||
//Change Value
|
//Change Value
|
||||||
LinkedListNode<T>? node = Traverse(i);
|
LinkedListNode<T>? node = Traverse(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user