INGEST: Clean up Java8 Stream Usage (#32059)

* GrokProcessor: Rationalize the loop over the map to save allocations and indirection
* IngestDocument: Rationalize way we append to `List`
This commit is contained in:
Armin Braun 2018-07-30 21:25:30 +02:00 committed by GitHub
parent c2e3bebab9
commit cf7489899a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -68,8 +68,7 @@ public final class GrokProcessor extends AbstractProcessor {
throw new IllegalArgumentException("Provided Grok expressions do not match field value: [" + fieldValue + "]");
}
matches.entrySet().stream()
.forEach((e) -> ingestDocument.setFieldValue(e.getKey(), e.getValue()));
matches.forEach(ingestDocument::setFieldValue);
if (traceMatch) {
if (matchPatterns.size() > 1) {

View File

@ -527,8 +527,7 @@ public final class IngestDocument {
private static void appendValues(List<Object> list, Object value) {
if (value instanceof List) {
List<?> valueList = (List<?>) value;
valueList.stream().forEach(list::add);
list.addAll((List<?>) value);
} else {
list.add(value);
}