将list集合的元素按照添加顺序的倒序进行排列取出

1.方法

Collections.reverse(list);

2.代码示例

/**
* 从redis中将现场状态的记录全部取出
* @param aucId
* @return
*/
@RequestMapping(value = "/findAllAuctionLocalStatementRecord", method = RequestMethod.POST)
@ResponseBody
public List<Object> findAllAuctionLocalStatementRecord(String aucId) {
if (logger.isDebugEnabled()) {
logger.debug("findAllAuctionLocalStatementRecord, aucId:{}", aucId);
} List<Object> list = redisTemplateListDTO.opsForValue().get("auctionLocalStatement"+aucId);
Collections.reverse(list);//将list集合倒序排列取出,时间最新的在最上面 return list;
}
上一篇:MyEclipse启动时报 Unable to acquire application service. Ensure that the org.eclips


下一篇:shell实现ping命令查看哪些主机在线