![](/img/trans.png)
[英]How to inject a list of implementations in a @InjectMockKs test instance?
[英]How to verify an instance of a List is not another List instance?
我有一個清單
var theDataList: List<Data> // populated with some data
並制作了一個副本
val copy = theDataList.toMutableList()
在代碼的下游,它想驗證它是副本一還是原始副本一
.hashCode()
對兩個返回相同
如果只想使用日志進行打印,該怎么辦?
Log.d("+++", "theDataList: ${theDataList.hashCode()}, copy: ${copy.hashCode()"})
打印出相同的數字。
然后Log.d("+++", "copy: ${copy}")
打印出列表內容
使用===
運算符比較引用是否相同(不調用equals
方法)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.