package com.sqltime;
import java.util.LinkedHashMap;
import java.util.Map;
public class TestUtil {
public static void main(String[] args) {
LinkedHashMap<String, Object> titleMap = new LinkedHashMap();
titleMap.put("aa", "111");
titleMap.put("bb", "222");
titleMap.put("cc", "333");
titleMap.put("dd", "444");
titleMap.put("ee", "555");
titleMap.put("ff", "666");
titleMap.put("gg", "777");
titleMap(3, titleMap);
}
public static LinkedHashMap<String, Object> titleMap(int rowNum, LinkedHashMap<String, Object> titleMap){
int indexNum = 1;
for (Map.Entry<String, Object> entry : titleMap.entrySet()) {
System.out.print(entry.getKey() +"==>" + entry.getValue() +"\t");
if(indexNum == rowNum){
indexNum = 1;
System.out.println("");
continue;
}
indexNum ++;
}
return titleMap;
}
}
/* 输出结果 */
aa==>111 bb==>222 cc==>333
dd==>444 ee==>555 ff==>666
gg==>777
根据每行固定数换行
于 2023-05-15 15:10:11 首次发布