Use diamonds.
diff --git a/src/main/java/org/apache/commons/mail/Email.java b/src/main/java/org/apache/commons/mail/Email.java
index 2408fcb..4c01376 100644
--- a/src/main/java/org/apache/commons/mail/Email.java
+++ b/src/main/java/org/apache/commons/mail/Email.java
@@ -222,16 +222,16 @@
protected String sslSmtpPort = "465";
/** List of "to" email addresses. */
- protected List<InternetAddress> toList = new ArrayList<InternetAddress>();
+ protected List<InternetAddress> toList = new ArrayList<>();
/** List of "cc" email addresses. */
- protected List<InternetAddress> ccList = new ArrayList<InternetAddress>();
+ protected List<InternetAddress> ccList = new ArrayList<>();
/** List of "bcc" email addresses. */
- protected List<InternetAddress> bccList = new ArrayList<InternetAddress>();
+ protected List<InternetAddress> bccList = new ArrayList<>();
/** List of "replyTo" email addresses. */
- protected List<InternetAddress> replyList = new ArrayList<InternetAddress>();
+ protected List<InternetAddress> replyList = new ArrayList<>();
/**
* Address to which undeliverable mail should be sent.
@@ -248,7 +248,7 @@
* or 2( high ) 3( normal ) 4( low ) and 5( lowest )
* Disposition-Notification-To: user@domain.net
*/
- protected Map<String, String> headers = new HashMap<String, String>();
+ protected Map<String, String> headers = new HashMap<>();
/**
* Used to determine whether to use pop3 before smtp, and if so the settings.
@@ -865,7 +865,7 @@
throw new EmailException("Address List provided was invalid");
}
- this.toList = new ArrayList<InternetAddress>(aCollection);
+ this.toList = new ArrayList<>(aCollection);
return this;
}
@@ -974,7 +974,7 @@
throw new EmailException("Address List provided was invalid");
}
- this.ccList = new ArrayList<InternetAddress>(aCollection);
+ this.ccList = new ArrayList<>(aCollection);
return this;
}
@@ -1083,7 +1083,7 @@
throw new EmailException("Address List provided was invalid");
}
- this.bccList = new ArrayList<InternetAddress>(aCollection);
+ this.bccList = new ArrayList<>(aCollection);
return this;
}
@@ -1162,7 +1162,7 @@
throw new EmailException("Address List provided was invalid");
}
- this.replyList = new ArrayList<InternetAddress>(aCollection);
+ this.replyList = new ArrayList<>(aCollection);
return this;
}
diff --git a/src/main/java/org/apache/commons/mail/HtmlEmail.java b/src/main/java/org/apache/commons/mail/HtmlEmail.java
index 3be05b0..54a232d 100644
--- a/src/main/java/org/apache/commons/mail/HtmlEmail.java
+++ b/src/main/java/org/apache/commons/mail/HtmlEmail.java
@@ -112,7 +112,7 @@
* Embedded images Map<String, InlineImage> where the key is the
* user-defined image name.
*/
- protected Map<String, InlineImage> inlineEmbeds = new HashMap<String, InlineImage>();
+ protected Map<String, InlineImage> inlineEmbeds = new HashMap<>();
/**
* Set the text content.
diff --git a/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java b/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java
index bb101ad..df36462 100644
--- a/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java
+++ b/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java
@@ -128,10 +128,10 @@
final StringBuffer stringBuffer = new StringBuffer();
// maps "cid" --> name
- final Map<String, String> cidCache = new HashMap<String, String>();
+ final Map<String, String> cidCache = new HashMap<>();
// maps "name" --> dataSource
- final Map<String, DataSource> dataSourceCache = new HashMap<String, DataSource>();
+ final Map<String, DataSource> dataSourceCache = new HashMap<>();
// in the String, replace all "img src" with a CID and embed the related
// image file if we find it.
diff --git a/src/main/java/org/apache/commons/mail/util/MimeMessageParser.java b/src/main/java/org/apache/commons/mail/util/MimeMessageParser.java
index 67961be..a9e4c7b 100644
--- a/src/main/java/org/apache/commons/mail/util/MimeMessageParser.java
+++ b/src/main/java/org/apache/commons/mail/util/MimeMessageParser.java
@@ -78,8 +78,8 @@
*/
public MimeMessageParser(final MimeMessage message)
{
- attachmentList = new ArrayList<DataSource>();
- cidMap = new HashMap<String, DataSource>();
+ attachmentList = new ArrayList<>();
+ cidMap = new HashMap<>();
this.mimeMessage = message;
this.isMultiPart = false;
}
diff --git a/src/test/java/org/apache/commons/mail/EmailLiveTest.java b/src/test/java/org/apache/commons/mail/EmailLiveTest.java
index 3742a51..c8d6733 100644
--- a/src/test/java/org/apache/commons/mail/EmailLiveTest.java
+++ b/src/test/java/org/apache/commons/mail/EmailLiveTest.java
@@ -329,7 +329,7 @@
@Test
public void testSendingEmailsInBatch() throws Exception
{
- final List<SimpleEmail> emails = new ArrayList<SimpleEmail>();
+ final List<SimpleEmail> emails = new ArrayList<>();
// we need to instantiate an email to provide the mail session - a bit ugly
final Session session = create(SimpleEmail.class).getMailSession();
diff --git a/src/test/java/org/apache/commons/mail/EmailTest.java b/src/test/java/org/apache/commons/mail/EmailTest.java
index 1551060..ffb965a 100644
--- a/src/test/java/org/apache/commons/mail/EmailTest.java
+++ b/src/test/java/org/apache/commons/mail/EmailTest.java
@@ -268,7 +268,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "me@home.com"));
arrExpected.add(
new InternetAddress(
@@ -316,7 +316,7 @@
// Test Success
// ====================================================================
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(
new InternetAddress(
@@ -350,7 +350,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -371,7 +371,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -393,7 +393,7 @@
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(
new InternetAddress(
"me@home.com",
@@ -422,7 +422,7 @@
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -450,7 +450,7 @@
// ====================================================================
// Test Success
// ====================================================================
- final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
+ final List<InternetAddress> testEmailValid2 = new ArrayList<>();
testEmailValid2.add(new InternetAddress("me@home.com", "Name1"));
testEmailValid2.add(
new InternetAddress(
@@ -489,7 +489,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -510,7 +510,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -532,7 +532,7 @@
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(
new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
@@ -558,7 +558,7 @@
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -586,7 +586,7 @@
// ====================================================================
// Test Success
// ====================================================================
- final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
+ final List<InternetAddress> testEmailValid2 = new ArrayList<>();
testEmailValid2.add(new InternetAddress("Name1 <me@home.com>"));
testEmailValid2.add(new InternetAddress("\"joe.doe@apache.org\" <joe.doe@apache.org>"));
testEmailValid2.add(
@@ -615,7 +615,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -638,7 +638,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -662,7 +662,7 @@
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -690,7 +690,7 @@
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -720,7 +720,7 @@
// ====================================================================
// Test Success
// ====================================================================
- final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
+ final List<InternetAddress> testInetEmailValid = new ArrayList<>();
testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
testInetEmailValid.add(
new InternetAddress(
@@ -754,7 +754,7 @@
// Test Success
// ====================================================================
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -779,7 +779,7 @@
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -806,7 +806,7 @@
final String[] testEmailNames = {"Name1", "", null};
- final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+ final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -836,7 +836,7 @@
// ====================================================================
// Test Success
// ====================================================================
- final Map<String, String> headers = new HashMap<String, String>();
+ final Map<String, String> headers = new HashMap<>();
headers.put("X-Priority", "1");
headers.put("Disposition-Notification-To", "me@home.com");
headers.put("X-Mailer", "Sendmail");
@@ -878,7 +878,7 @@
@Test
public void testSetHeaders()
{
- final Map<String, String> ht = new Hashtable<String, String>();
+ final Map<String, String> ht = new Hashtable<>();
ht.put("X-Priority", "1");
ht.put("Disposition-Notification-To", "me@home.com");
ht.put("X-Mailer", "Sendmail");
@@ -892,7 +892,7 @@
@Test
public void testGetHeader()
{
- final Map<String, String> ht = new Hashtable<String, String>();
+ final Map<String, String> ht = new Hashtable<>();
ht.put("X-Foo", "Bar");
ht.put("X-Int", "1");
@@ -905,7 +905,7 @@
@Test
public void testGetHeaders()
{
- final Map<String, String> ht = new Hashtable<String, String>();
+ final Map<String, String> ht = new Hashtable<>();
ht.put("X-Foo", "Bar");
ht.put("X-Int", "1");
@@ -1136,7 +1136,7 @@
@Test
public void testToInternetAddressArray() throws Exception
{
- final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
+ final List<InternetAddress> testInetEmailValid = new ArrayList<>();
testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
testInetEmailValid.add(
diff --git a/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java b/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
index 84178d4..612b1fb 100644
--- a/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
+++ b/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
@@ -138,7 +138,7 @@
testEmail.setMsg("Test Message");
- final Map<String, String> ht = new HashMap<String, String>();
+ final Map<String, String> ht = new HashMap<>();
ht.put("X-Priority", "2");
ht.put("Disposition-Notification-To", this.strTestMailFrom);
ht.put("X-Mailer", "Sendmail");