Use final and lambda shorthand

This commit is contained in:
Gary Gregory 2022-10-25 21:38:18 -04:00
parent 0dd1bcc62e
commit ed43bba32c
3 changed files with 5 additions and 4 deletions

View File

@ -2305,7 +2305,7 @@ public final class CSVFormat implements Serializable {
if (headers != null && duplicateHeaderMode != DuplicateHeaderMode.ALLOW_ALL) {
final Set<String> dupCheckSet = new HashSet<>(headers.length);
final boolean emptyDuplicatesAllowed = duplicateHeaderMode == DuplicateHeaderMode.ALLOW_EMPTY;
for (String header : headers) {
for (final String header : headers) {
final boolean blank = isBlank(header);
// Sanitise all empty headers to the empty string "" when checking duplicates
final boolean containsHeader = !dupCheckSet.add(blank ? "" : header);

View File

@ -53,6 +53,7 @@ import java.util.stream.Collectors;
import org.apache.commons.io.input.BOMInputStream;
import org.apache.commons.io.input.BrokenInputStream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -113,7 +114,7 @@ public class CSVParserTest {
}
private void parseFully(final CSVParser parser) {
parser.forEach(record -> assertNotNull(record));
parser.forEach(Assertions::assertNotNull);
}
@Test

View File

@ -31,8 +31,8 @@ import org.junit.jupiter.api.Test;
public class JiraCsv288Test {
private void print(final CSVRecord csvRecord, CSVPrinter csvPrinter) throws IOException {
for (String value : csvRecord) {
private void print(final CSVRecord csvRecord, final CSVPrinter csvPrinter) throws IOException {
for (final String value : csvRecord) {
csvPrinter.print(value);
}
}