我在 Groovy 中声明字节数组:
def array1 = [-1,5,3] as byte []
def array2 = [-5,2,9] as byte []
如何根据数组的每个元素是否相同来比较两个数组以返回真/假。
我试过这个,groovysh
但它一直出错:
groovy:000> def array1 = [-1,5,3] as byte[]
===> [B@18e501c
groovy:000> def array2 = [-5,2,9] as byte[]
===> [B@5e860ba9
groovy:000> array1.equals array2
ERROR groovy.lang.MissingPropertyException:
No such property: array1 for class: groovysh_evaluate
at groovysh_evaluate.run (groovysh_evaluate:2)
...