How to sort an ArrayList with object using stream().sorted()

前端 未结 5 1640

I am having real trouble with using stream and sorted to sort my ArrayList and hope someone can help out. The code uses Croatian words, but I don\'t think that will be a pro

5条回答
  •  失恋的感觉
    2021-01-13 09:07

    You can also do it in that way:

    listaPublikacija.stream().sorted(Comparator.comparingDouble(Publikacija::getCijena));
    

提交回复
热议问题