Author: ggregory
Date: Mon Jun 13 02:29:53 2016
New Revision: 1748079
URL: http://svn.apache.org/viewvc?rev=1748079&view=rev
Log:
Use generics diamonds.
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
(original)
+++
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Mon Jun 13 02:29:53 2016
@@ -1215,7 +1215,7 @@ public final class CSVFormat implements
// 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(
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
(original)
+++
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
Mon Jun 13 02:29:53 2016
@@ -216,7 +216,7 @@ public final class CSVParser implements
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
* @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
*/
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);
}
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
Mon Jun 13 02:29:53 2016
@@ -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() {
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
Mon Jun 13 02:29:53 2016
@@ -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");
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Mon Jun 13 02:29:53 2016
@@ -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("\\");
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java?rev=1748079&r1=1748078&r2=1748079&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
Mon Jun 13 02:29:53 2016
@@ -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());