You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 19:05:38 UTC
[commons-collections] branch master updated: Use a String instead
of building one.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new e013bd8 Use a String instead of building one.
e013bd8 is described below
commit e013bd8d77014d5f7db81ae477a6181e510abd86
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 21 14:05:34 2020 -0500
Use a String instead of building one.
---
.../collections4/collection/AbstractCollectionTest.java | 6 +++---
.../commons/collections4/list/SetUniqueListTest.java | 12 ++++++------
.../collections4/sequence/SequencesComparatorTest.java | 16 ++++++++--------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
index 3341618..64d39f3 100644
--- a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
+++ b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
@@ -424,8 +424,8 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
@SuppressWarnings("unchecked")
public E[] getFullNonNullElements() {
return (E[]) new Object[] {
- new String(""),
- new String("One"),
+ "",
+ "One",
Integer.valueOf(2),
"Three",
Integer.valueOf(4),
@@ -434,7 +434,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
new Float(6),
"Seven",
"Eight",
- new String("Nine"),
+ "Nine",
Integer.valueOf(10),
new Short((short) 11),
new Long(12),
diff --git a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
index 4aea06d..89ec2c4 100644
--- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
@@ -60,8 +60,8 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
public E[] getFullNonNullElements() {
// override to avoid duplicate "One"
return (E[]) new Object[] {
- new String(""),
- new String("One"),
+ "",
+ "One",
Integer.valueOf(2),
"Three",
Integer.valueOf(4),
@@ -69,7 +69,7 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
new Float(6),
"Seven",
"Eight",
- new String("Nine"),
+ "Nine",
Integer.valueOf(10),
new Short((short) 11),
new Long(12),
@@ -535,9 +535,9 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
final HashSet<E> s = new HashSet<>();
final SetUniqueList<E> ul = new SetUniqueList<>(l, s);
- final E a = (E) new String("A");
- final E b = (E) new String("B");
- final E c = (E) new String("C");
+ final E a = (E) "A";
+ final E b = (E) "B";
+ final E c = (E) "C";
ul.add(a);
ul.add(b);
diff --git a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
index 6062fc6..3e07e18 100644
--- a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
+++ b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java
@@ -56,10 +56,10 @@ public class SequencesComparatorTest {
@Test
public void testMinimal() {
final String[] shadokAlph = new String[] {
- new String("GA"),
- new String("BU"),
- new String("ZO"),
- new String("MEU")
+ "GA",
+ "BU",
+ "ZO",
+ "MEU"
};
final List<String> sentenceBefore = new ArrayList<>();
final List<String> sentenceAfter = new ArrayList<>();
@@ -108,10 +108,10 @@ public class SequencesComparatorTest {
public void testShadok() {
final int lgMax = 5;
final String[] shadokAlph = new String[] {
- new String("GA"),
- new String("BU"),
- new String("ZO"),
- new String("MEU")
+ "GA",
+ "BU",
+ "ZO",
+ "MEU"
};
List<List<String>> shadokSentences = new ArrayList<>();
for (int lg=0; lg<lgMax; ++lg) {