Use generics diamonds.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1748079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2016-06-13 02:29:53 +00:00
parent 285978743f
commit ed6adc706e
6 changed files with 13 additions and 13 deletions

View File

@ -1215,7 +1215,7 @@ public final class CSVFormat implements Serializable {
// validate header
if (header != null) {
final Set<String> dupCheck = new HashSet<String>();
final Set<String> dupCheck = new HashSet<>();
for (final String hdr : header) {
if (!dupCheck.add(hdr)) {
throw new IllegalArgumentException(

View File

@ -216,7 +216,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
private final Lexer lexer;
/** A record buffer for getRecord(). Grows as necessary and is reused. */
private final List<String> record = new ArrayList<String>();
private final List<String> record = new ArrayList<>();
/**
* The next record number to assign.
@ -331,7 +331,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
* @return a copy of the header map that iterates in column order.
*/
public Map<String, Integer> getHeaderMap() {
return this.headerMap == null ? null : new LinkedHashMap<String, Integer>(this.headerMap);
return this.headerMap == null ? null : new LinkedHashMap<>(this.headerMap);
}
/**
@ -362,7 +362,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
*/
public List<CSVRecord> getRecords() throws IOException {
CSVRecord rec;
final List<CSVRecord> records = new ArrayList<CSVRecord>();
final List<CSVRecord> records = new ArrayList<>();
while ((rec = this.nextRecord()) != null) {
records.add(rec);
}

View File

@ -69,7 +69,7 @@ public class CSVFileParserTest {
@Parameters
public static Collection<Object[]> generateData() {
final List<Object[]> list = new ArrayList<Object[]>();
final List<Object[]> list = new ArrayList<>();
final FilenameFilter filenameFilter = new FilenameFilter() {

View File

@ -393,7 +393,7 @@ public class CSVParserTest {
@Test
public void testForEach() throws Exception {
final List<CSVRecord> records = new ArrayList<CSVRecord>();
final List<CSVRecord> records = new ArrayList<>();
final Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");

View File

@ -495,7 +495,7 @@ public class CSVPrinterTest {
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, format);
final List<String> list = new LinkedList<String>();
final List<String> list = new LinkedList<>();
list.add("\"");
printer.printRecord(list);
printer.close();
@ -511,7 +511,7 @@ public class CSVPrinterTest {
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, format);
final List<String> list = new LinkedList<String>();
final List<String> list = new LinkedList<>();
list.add("\n");
printer.printRecord(list);
printer.close();
@ -527,7 +527,7 @@ public class CSVPrinterTest {
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, format);
final List<String> list = new LinkedList<String>();
final List<String> list = new LinkedList<>();
list.add("\\");
printer.printRecord(list);
printer.close();
@ -543,7 +543,7 @@ public class CSVPrinterTest {
final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, format);
final List<String> list = new LinkedList<String>();
final List<String> list = new LinkedList<>();
list.add("\"");
list.add("\n");
list.add("\\");

View File

@ -46,7 +46,7 @@ public class CSVRecordTest {
public void setUp() throws Exception {
values = new String[] { "A", "B", "C" };
record = new CSVRecord(values, null, null, 0, -1);
header = new HashMap<String, Integer>();
header = new HashMap<>();
header.put("first", Integer.valueOf(0));
header.put("second", Integer.valueOf(1));
header.put("third", Integer.valueOf(2));
@ -132,7 +132,7 @@ public class CSVRecordTest {
@Test
public void testPutInMap() {
final Map<String, String> map = new ConcurrentHashMap<String, String>();
final Map<String, String> map = new ConcurrentHashMap<>();
this.recordWithHeader.putIn(map);
this.validateMap(map, false);
// Test that we can compile with assigment to the same map as the param.
@ -148,7 +148,7 @@ public class CSVRecordTest {
map.remove("OldColumn");
map.put("ZColumn", "NewValue");
// check:
final ArrayList<String> list = new ArrayList<String>(map.values());
final ArrayList<String> list = new ArrayList<>(map.values());
Collections.sort(list);
printer.printRecord(list);
Assert.assertEquals("A,B,C,NewValue" + CSVFormat.DEFAULT.getRecordSeparator(), printer.getOut().toString());