// Merge two Disease list with the 'and' operator
Merge two Disease list with the 'and' operator
// Merge two Disease list with the ' and ' operator
func andMerge(list1 []*Disease, list2 []*Disease) []*Disease {
	var mergeResult []*Disease
	for _, item1 := range list1 {
		for _, item2 := range list2 {
			if item1.Name == item2.Name {
				mergeResult = append(mergeResult, item1)
			}
		}
	}
	for _, item2 := range list2 {
		for _, item1 := range list1 {
			if item1.Name == item2.Name {
				contains := false
				for _, itemR := range mergeResult {
					if itemR.Name == item2.Name {
						contains = true
						break
					}
				}
				if !contains {
					mergeResult = append(mergeResult, item2)
				}
			}
		}
	}
	return mergeResult
}
func andMerge ( list1 [ ] * Disease , list2 [ ] * Disease ) [ ] * Disease { var mergeResult [ ] * Disease for _ , item1 := range list1 { for _ , item2 := range list2 { if item1 . Name == item2 . Name { mergeResult = append ( mergeResult , item1 ) } } } for _ , item2 := range list2 { for _ , item1 := range list1 { if item1 . Name == item2 . Name { contains := false for _ , itemR := range mergeResult { if itemR . Name == item2 . Name { contains = true break } } if ! contains { mergeResult = append ( mergeResult , item2 ) } } } } return mergeResult }
Merge two Disease list with the 'and' operator
Merge two Disease list with the ' and ' operator
// Put all item of list1 contained in list2 in mergeResult // Put all item of list2 contained in list1 in mergeResult // Check that the item is not allready in mergeResult