From 3c6788b9dab9c41a6dc1fec051ea860779a74132 Mon Sep 17 00:00:00 2001 From: michaelahojna Date: Thu, 6 Oct 2022 11:32:16 +0200 Subject: [PATCH] style: edit code style --- .../com/influxdb/query/internal/FluxCsvParser.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java b/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java index d41bb3d27b5..db4633c4d68 100644 --- a/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java +++ b/client-core/src/main/java/com/influxdb/query/internal/FluxCsvParser.java @@ -33,6 +33,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -404,11 +405,13 @@ private void addColumnNamesAndTags(@Nonnull final FluxTable table, @Nonnull fina fluxColumn.setLabel(columnName); } - HashSet seen = new HashSet<>(); - columnNames.removeIf(seen::add); + Set items = new HashSet<>(); + Set duplicates = columnNames.stream() + .filter(n -> !items.add(n)) + .collect(Collectors.toSet()); - if (!columnNames.isEmpty()) { - System.out.printf("The response contains columns with duplicated names: %s)%n", columnNames); + if (!duplicates.isEmpty()) { + System.out.printf("The response contains columns with duplicated names: %s)%n", duplicates); System.out.println("You should use the \"FluxRecord.getRow()\" to access your data instead of " + "\"FluxRecord.getValues()\"."); }