I am trying to return the index of a selected item in my Vector collection
type Node
name::AbstractString
value::Int
left::Nullable{Node}
right::Nullable{Node}
Node(name::AbstractString, value::Int) = new(name, value, Nullable{Node}(), Nullable{Node}())
end
function minimal(nodes::Vector{Node})
minnode=Nullable{Node}()
minval = nodes[1].value
for f in nodes
if f.value< minval
minval= f.value
minnode = f
end
end
return find(nodes .== minnode)
end
The problem, of course, find(nodes .== minnode)
is how can I return the index of this element
source
share