2013-07-15 40 views
-1

事實上,在這種情況下,我需要一些隨機排序的解決方案。我試圖通過Collections如何排序solrdocumentlist對象

SolrDocumentList randSolrDocs = Collections.shuffle(solrDocList) 

排序卻收到一個錯誤Type mismatch: cannot convert from void to SolrDocumentList

請幫忙。

回答

1

Collections.shuffle(solrDocList)將您作爲參數傳遞的列表進行混洗。該方法沒有返回值。

所以在通話之後,solrDocList是隨機的。

+0

非常感謝,我的可怕的注意力不集中 –