The NodeWithValue method

In the following code snippet, the NodeWithValue method of LinkedList returns the node with the property value. The list is traversed and checked to see whether the property value is equal to the parameter property:

//NodeWithValue method returns Node given parameter property

func (linkedList *LinkedList) NodeWithValue(property int) *Node{
var node *Node
var nodeWith *Node
for node = linkedList.headNode; node != nil; node = node.nextNode {
if node.property == property {
nodeWith = node
break;
}
}
return nodeWith
}