mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
442 B
19 lines
442 B
package solutions |
|
|
|
// finds the element and returns the first data from the node that is a string |
|
func ListFind(l *List, ref interface{}, comp func(a, b interface{}) bool) *interface{} { |
|
iterator := l.Head |
|
for iterator != nil { |
|
if comp(iterator.Data, ref) { |
|
return &iterator.Data |
|
} |
|
|
|
iterator = iterator.Next |
|
} |
|
return nil |
|
} |
|
|
|
// defines for two elements the equality criteria |
|
func CompStr(a, b interface{}) bool { |
|
return a == b |
|
}
|
|
|