|
@@ -22,7 +22,8 @@ public class CommonData {
|
|
// -1 表示时间
|
|
// -1 表示时间
|
|
// log.info("数据长度(包含时间):" + map.size());
|
|
// log.info("数据长度(包含时间):" + map.size());
|
|
if (!map.isEmpty()) {
|
|
if (!map.isEmpty()) {
|
|
- map.put(0, sdf.format(System.currentTimeMillis()));
|
|
|
|
|
|
+ String nowTime = sdf.format(System.currentTimeMillis());
|
|
|
|
+ map.put(0, nowTime);
|
|
list.add(new TreeMap<>(map));
|
|
list.add(new TreeMap<>(map));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -32,8 +33,34 @@ public class CommonData {
|
|
}
|
|
}
|
|
|
|
|
|
public static List<Map<Integer, Object>> getListAndClean() {
|
|
public static List<Map<Integer, Object>> getListAndClean() {
|
|
- List<Map<Integer, Object>> nowList = new ArrayList<>(list);
|
|
|
|
- list.clear();
|
|
|
|
|
|
+ int index = list.size() - 1;
|
|
|
|
+ for (int i = list.size() - 1; i >= 0; i--) {
|
|
|
|
+ if (String.valueOf(list.get(i).get(0)).endsWith("9:50") || String.valueOf(list.get(i).get(0)).endsWith("9:59")) {
|
|
|
|
+ index = i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Map<Integer, Object>> nowList = new ArrayList<>(list.subList(0, index + 1));
|
|
|
|
+ list.subList(0, index + 1).clear();
|
|
return nowList;
|
|
return nowList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) throws InterruptedException {
|
|
|
|
+ put(1, 2);
|
|
|
|
+ for (int j = 0; j < 3; j++) {
|
|
|
|
+ for (int i = 0; i < 60; i++) {
|
|
|
|
+ addList();
|
|
|
|
+ Thread.sleep(1000);
|
|
|
|
+ }
|
|
|
|
+ for (Map<Integer, Object> entry : getListAndClean()) {
|
|
|
|
+ System.out.println(entry);
|
|
|
|
+ }
|
|
|
|
+ System.out.println("----------------------------------");
|
|
|
|
+ for (Map<Integer, Object> entry : list) {
|
|
|
|
+ System.out.println(entry);
|
|
|
|
+ }
|
|
|
|
+ System.out.println("**************************************");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|