交换机采集数据优化

This commit is contained in:
qiminbao
2025-09-26 14:13:19 +08:00
parent 90af1f83ca
commit b07abc881d
3 changed files with 70 additions and 42 deletions
@@ -13,10 +13,7 @@ import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Base64;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.*;
public class AgentUtil {
@@ -234,4 +231,14 @@ public class AgentUtil {
return null;
}
public static LinkedHashMap<String, String> swapMap(LinkedHashMap<String, String> original) {
LinkedHashMap<String, String> swapped = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : original.entrySet()) {
if (entry.getValue() != null) { // 避免 null key
swapped.put(entry.getValue(), entry.getKey());
}
}
return swapped;
}
}