Sort是不是过时了,怎么替代呢

Sort sort=null;

		if(sortType==null||sortType.trim().length()==0) {
			sort=new Sort(Direction.DESC,"createTime");
		}else if("newest".equals(sortType)) {
			sort=new Sort(Direction.DESC,"createTime");
		}else if("hottest".equals(sortType)) {
			sort=new Sort(Direction.DESC,"hits");
			}

提示:The constructor Sort(Sort.Direction, String) is undefined

你这问的没头没脑的。谁知道怎么回答。你不信,你自己换个陌生人角度读读看!

1 个赞

这个异常不是过时,而是没找到这个构造函数。

Sort(Sort.Direction, String) 

自己点开源码看看,支持哪些构造方式。

Sort.by(Sort.Order.desc(“createTime”))

3 个赞