java.math.BigInteger cannot be cast to java.lang.Long

前端 未结 8 693
醉话见心
醉话见心 2020-12-09 15:44

I\'ve got List dynamics. And I want to get max result using Collections. This is my code:

List dynamics=spy         


        
相关标签:
8条回答
  • 2020-12-09 16:12

    Your error might be in this line:

    List<Long> result = query.list();
    

    where query.list() is returning a BigInteger List instead of Long list. Try to change it to.

    List<BigInteger> result = query.list();
    
    0 讨论(0)
  • 2020-12-09 16:25

    Try to convert the BigInteger to a long like this

    Long longNumber= bigIntegerNumber.longValue();
    
    0 讨论(0)
提交回复
热议问题