JAVA
赠予最好的你
这个作者很懒,什么都没留下…
展开
-
Java数据类型曾用方法
【Double 转 String :保留三位小数】 Double double1 = 123456789.123456789; DecimalFormat decimalFormat = new DecimalFormat("#0.00");//格式化设置 System.out.println(decimalFormat.format(double1)); //结果:...原创 2019-07-16 17:22:33 · 1088 阅读 · 0 评论 -
Map中value排序,返回key的list集合
对map中的value进行【降序】排序,返回对应的key的Listprivate List<Long> getMapKeyByValueMax(Map<Long, Integer> map) { List<Map.Entry<Long, Integer>> list = new ArrayList<Map.Entry<Long, I...原创 2019-07-16 17:44:41 · 1117 阅读 · 0 评论 -
将a和b,按照a分组,并将b存入list返回
public Map<Long, List> putMapByItem(List<Object[]> inventoryItems){Map<Long,List> map = new HashMap<Long,List>();for (Object[] objects : inventoryItems){Long itemID =(Long...原创 2019-07-16 21:05:09 · 158 阅读 · 0 评论 -
循环list,删除指定元素
Iterator<Map<String, Object>> it = list.iterator();while (it.hasNext()) { if(condition){ it.remove(); } }原创 2019-07-17 14:43:54 · 106 阅读 · 0 评论