Вот так можно
package test;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Main {
private final HashMap<String, Service> modes = new HashMap<>();
public static void main(String[] args) {
List<Map> listOfMap = new ArrayList();
for (int i = 0; i < 10; i++) {
Map<String, Object> columns = new HashMap();
columns.put("description", "inaccessibleError.getDescription()");
columns.put("errorPriority", i % 2 == 0 ? "inaccessibleError.getPriority()" : "other");
columns.put("agentId", i);
columns.put("systemType", "agentType.getDisplayName()");
columns.put("fqdn", "agentFqdn");
columns.put("errorMessage", "p.errorMessage");
columns.put("path", "path");
columns.put("errorTime", "errorDateTime");
columns.put("errorCount", "errorCount");
columns.put("notShownErrorCount", "errorCount <= limitByPath ? 0 : errorCount - limitByPath");
columns.put("foldersTotalErrorCount", "foldersTotalErrorCount[0]");
columns.put("filesTotalErrorCount", "filesTotalErrorCount[0]");
listOfMap.add(columns);
}
List result =
listOfMap.stream()
.filter(map -> map.get("errorPriority").equals("inaccessibleError.getPriority()"))
.collect(Collectors.toList());
result.forEach(System.out::println);
}
}
и ответ
{path=path, errorTime=errorDateTime, foldersTotalErrorCount=foldersTotalErrorCount[0], agentId=0, errorPriority=inaccessibleError.getPriority(), fqdn=agentFqdn, notShownErrorCount=errorCount <= limitByPath ? 0 : errorCount - limitByPath, filesTotalErrorCount=filesTotalErrorCount[0], systemType=agentType.getDisplayName(), errorMessage=p.errorMessage, description=inaccessibleError.getDescription(), errorCount=errorCount}
{path=path, errorTime=errorDateTime, foldersTotalErrorCount=foldersTotalErrorCount[0], agentId=2, errorPriority=inaccessibleError.getPriority(), fqdn=agentFqdn, notShownErrorCount=errorCount <= limitByPath ? 0 : errorCount - limitByPath, filesTotalErrorCount=filesTotalErrorCount[0], systemType=agentType.getDisplayName(), errorMessage=p.errorMessage, description=inaccessibleError.getDescription(), errorCount=errorCount}
{path=path, errorTime=errorDateTime, foldersTotalErrorCount=foldersTotalErrorCount[0], agentId=4, errorPriority=inaccessibleError.getPriority(), fqdn=agentFqdn, notShownErrorCount=errorCount <= limitByPath ? 0 : errorCount - limitByPath, filesTotalErrorCount=filesTotalErrorCount[0], systemType=agentType.getDisplayName(), errorMessage=p.errorMessage, description=inaccessibleError.getDescription(), errorCount=errorCount}
{path=path, errorTime=errorDateTime, foldersTotalErrorCount=foldersTotalErrorCount[0], agentId=6, errorPriority=inaccessibleError.getPriority(), fqdn=agentFqdn, notShownErrorCount=errorCount <= limitByPath ? 0 : errorCount - limitByPath, filesTotalErrorCount=filesTotalErrorCount[0], systemType=agentType.getDisplayName(), errorMessage=p.errorMessage, description=inaccessibleError.getDescription(), errorCount=errorCount}
{path=path, errorTime=errorDateTime, foldersTotalErrorCount=foldersTotalErrorCount[0], agentId=8, errorPriority=inaccessibleError.getPriority(), fqdn=agentFqdn, notShownErrorCount=errorCount <= limitByPath ? 0 : errorCount - limitByPath, filesTotalErrorCount=filesTotalErrorCount[0], systemType=agentType.getDisplayName(), errorMessage=p.errorMessage, description=inaccessibleError.getDescription(), errorCount=errorCount}
Естественно в вашем случае
фильтер будет таким
.filter(map -> map.get("errorPriority").equals(inaccessibleError.getPriority()))