我有List<Long> dynamics
。我想使用Collections
. 这是我的代码:
List<Long> dynamics=spyPathService.getDynamics();
Long max=((Long)Collections.max(dynamics)).longValue();
这是我的getDynamics
:
public List<Long> getDynamics() {
Session session = null;
session = this.sessionFactory.getCurrentSession();
Query query = session
.createSQLQuery("SELECT COUNT(*) FROM SpyPath WHERE DATE(time)>=DATE_SUB(CURDATE(),INTERVAL 6 DAY) GROUP BY DATE(time) ORDER BY time;");
List<Long> result = query.list();
return result;
}
现在我得到java.math.BigInteger cannot be cast to java.lang.Long
. 怎么了?