mirror of https://github.com/poanetwork/gecko.git
34 lines
563 B
Go
34 lines
563 B
Go
|
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
||
|
// See the file LICENSE for licensing terms.
|
||
|
|
||
|
package ids
|
||
|
|
||
|
// Equals returns true if the arrays are equal
|
||
|
func Equals(a, b []ID) bool {
|
||
|
if len(a) != len(b) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
for i, aID := range a {
|
||
|
if !aID.Equals(b[i]) {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// UnsortedEquals returns true if the have the same number of each ID
|
||
|
func UnsortedEquals(a, b []ID) bool {
|
||
|
if len(a) != len(b) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
aBag := Bag{}
|
||
|
aBag.Add(a...)
|
||
|
|
||
|
bBag := Bag{}
|
||
|
bBag.Add(b...)
|
||
|
|
||
|
return aBag.Equals(bBag)
|
||
|
}
|