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 2024/06/23 18:45:05 UTC
(commons-collections) branch master updated (f5e0f2c09 -> 1182f90ae)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
from f5e0f2c09 Use Collections.sort(List) for clarity
new f55d552c9 Use if-else
new 5ebd823ae Use Collections.sort(List) for clarity
new 640b5e1c6 Use Collections.sort(List) for clarity
new 0e3f2d3de Remove unnecessary keyword
new 1364973ff Use if-else
new 1182f90ae Remove unnecessary keyword
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/commons/collections4/map/Flat3Map.java | 234 ++++++++++-----------
.../collections4/sequence/SequencesComparator.java | 12 +-
.../commons/collections4/FluentIterableTest.java | 6 +-
.../commons/collections4/IteratorUtilsTest.java | 2 +-
.../bloomfilter/LayeredBloomFilterTest.java | 2 +-
.../bloomfilter/WrappedBloomFilterTest.java | 4 +-
6 files changed, 125 insertions(+), 135 deletions(-)
(commons-collections) 06/06: Remove unnecessary keyword
Posted by gg...@apache.org.
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
commit 1182f90ae64ba15cd303afe0eaa269d4158f0343
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:22:15 2024 -0400
Remove unnecessary keyword
---
.../commons/collections4/bloomfilter/WrappedBloomFilterTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilterTest.java
index 6f0df0cf7..e5947a90a 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/WrappedBloomFilterTest.java
@@ -29,7 +29,7 @@ public class WrappedBloomFilterTest extends AbstractBloomFilterTest<WrappedBloom
@Override
public BloomFilter copy() {
final BloomFilter result = new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape);
- result.merge(this.getWrapped());
+ result.merge(getWrapped());
return result;
}
};
@@ -49,7 +49,7 @@ public class WrappedBloomFilterTest extends AbstractBloomFilterTest<WrappedBloom
@Override
public BloomFilter copy() {
final BloomFilter result = new DefaultBloomFilterTest.SparseDefaultBloomFilter(shape);
- result.merge(this.getWrapped());
+ result.merge(getWrapped());
return result;
}
};
(commons-collections) 01/06: Use if-else
Posted by gg...@apache.org.
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
commit f55d552c90c06e0be69dec580bb6ab8324347e07
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:21:16 2024 -0400
Use if-else
---
.../apache/commons/collections4/map/Flat3Map.java | 234 ++++++++++-----------
1 file changed, 113 insertions(+), 121 deletions(-)
diff --git a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
index d1b799fdf..02f61e740 100644
--- a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
+++ b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
@@ -614,22 +614,20 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
return true;
}
}
- } else {
- if (size > 0) {
- final int hashCode = key.hashCode();
- switch (size) { // drop through
- case 3:
- if (hash3 == hashCode && key.equals(key3)) {
- return true;
- }
- case 2:
- if (hash2 == hashCode && key.equals(key2)) {
- return true;
- }
- case 1:
- if (hash1 == hashCode && key.equals(key1)) {
- return true;
- }
+ } else if (size > 0) {
+ final int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ return true;
+ }
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ return true;
+ }
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ return true;
}
}
}
@@ -817,23 +815,21 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
return value1;
}
}
- } else {
- if (size > 0) {
- final int hashCode = key.hashCode();
- switch (size) {
- // drop through
- case 3:
- if (hash3 == hashCode && key.equals(key3)) {
- return value3;
- }
- case 2:
- if (hash2 == hashCode && key.equals(key2)) {
- return value2;
- }
- case 1:
- if (hash1 == hashCode && key.equals(key1)) {
- return value1;
- }
+ } else if (size > 0) {
+ final int hashCode = key.hashCode();
+ switch (size) {
+ // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ return value3;
+ }
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ return value2;
+ }
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ return value1;
}
}
}
@@ -947,28 +943,26 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
return old;
}
}
- } else {
- if (size > 0) {
- final int hashCode = key.hashCode();
- switch (size) { // drop through
- case 3:
- if (hash3 == hashCode && key.equals(key3)) {
- final V old = value3;
- value3 = value;
- return old;
- }
- case 2:
- if (hash2 == hashCode && key.equals(key2)) {
- final V old = value2;
- value2 = value;
- return old;
- }
- case 1:
- if (hash1 == hashCode && key.equals(key1)) {
- final V old = value1;
- value1 = value;
- return old;
- }
+ } else if (size > 0) {
+ final int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ final V old = value3;
+ value3 = value;
+ return old;
+ }
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ final V old = value2;
+ value2 = value;
+ return old;
+ }
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ final V old = value1;
+ value1 = value;
+ return old;
}
}
}
@@ -1123,72 +1117,70 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
return old;
}
}
- } else {
- if (size > 0) {
- final int hashCode = key.hashCode();
- switch (size) { // drop through
- case 3:
- if (hash3 == hashCode && key.equals(key3)) {
- final V old = value3;
- hash3 = 0;
- key3 = null;
- value3 = null;
- size = 2;
- return old;
- }
- if (hash2 == hashCode && key.equals(key2)) {
- final V old = value2;
- hash2 = hash3;
- key2 = key3;
- value2 = value3;
- hash3 = 0;
- key3 = null;
- value3 = null;
- size = 2;
- return old;
- }
- if (hash1 == hashCode && key.equals(key1)) {
- final V old = value1;
- hash1 = hash3;
- key1 = key3;
- value1 = value3;
- hash3 = 0;
- key3 = null;
- value3 = null;
- size = 2;
- return old;
- }
- return null;
- case 2:
- if (hash2 == hashCode && key.equals(key2)) {
- final V old = value2;
- hash2 = 0;
- key2 = null;
- value2 = null;
- size = 1;
- return old;
- }
- if (hash1 == hashCode && key.equals(key1)) {
- final V old = value1;
- hash1 = hash2;
- key1 = key2;
- value1 = value2;
- hash2 = 0;
- key2 = null;
- value2 = null;
- size = 1;
- return old;
- }
- return null;
- case 1:
- if (hash1 == hashCode && key.equals(key1)) {
- final V old = value1;
- hash1 = 0;
- key1 = null;
- value1 = null;
- size = 0;
- return old;
- }
+ } else if (size > 0) {
+ final int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ final V old = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (hash2 == hashCode && key.equals(key2)) {
+ final V old = value2;
+ hash2 = hash3;
+ key2 = key3;
+ value2 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (hash1 == hashCode && key.equals(key1)) {
+ final V old = value1;
+ hash1 = hash3;
+ key1 = key3;
+ value1 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ return null;
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ final V old = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ if (hash1 == hashCode && key.equals(key1)) {
+ final V old = value1;
+ hash1 = hash2;
+ key1 = key2;
+ value1 = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ return null;
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ final V old = value1;
+ hash1 = 0;
+ key1 = null;
+ value1 = null;
+ size = 0;
+ return old;
}
}
}
(commons-collections) 03/06: Use Collections.sort(List) for clarity
Posted by gg...@apache.org.
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
commit 640b5e1c61bd49ff0fe0cbbc6a4a172669a96d4b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:21:38 2024 -0400
Use Collections.sort(List) for clarity
---
src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
index aafbacaf1..ce05a4831 100644
--- a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
@@ -464,7 +464,7 @@ public class IteratorUtilsTest {
final List<Integer> combinedList = new ArrayList<>(collectionOdd);
combinedList.addAll(collectionEven);
- combinedList.sort(null);
+ Collections.sort(combinedList);
assertEquals(combinedList, result);
(commons-collections) 02/06: Use Collections.sort(List) for clarity
Posted by gg...@apache.org.
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
commit 5ebd823ae30a51026cf48f68710573c066a32c70
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:21:26 2024 -0400
Use Collections.sort(List) for clarity
---
.../java/org/apache/commons/collections4/FluentIterableTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
index 6d1aa48d6..2a528be1f 100644
--- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
+++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
@@ -165,7 +165,7 @@ public class FluentIterableTest {
final List<Integer> combinedList = new ArrayList<>();
CollectionUtils.addAll(combinedList, iterableOdd);
CollectionUtils.addAll(combinedList, iterableEven);
- combinedList.sort(null);
+ Collections.sort(combinedList);
assertEquals(combinedList, result);
assertThrows(NullPointerException.class, () -> FluentIterable.of(iterableOdd).collate(null).toList(),
@@ -183,7 +183,7 @@ public class FluentIterableTest {
final List<Integer> combinedList = new ArrayList<>();
CollectionUtils.addAll(combinedList, iterableOdd);
CollectionUtils.addAll(combinedList, iterableEven);
- combinedList.sort(null);
+ Collections.sort(combinedList);
assertEquals(combinedList, result);
// null comparator is equivalent to natural ordering
@@ -446,7 +446,7 @@ public class FluentIterableTest {
List<Integer> combinedList = new ArrayList<>();
CollectionUtils.addAll(combinedList, iterableOdd);
CollectionUtils.addAll(combinedList, iterableEven);
- combinedList.sort(null);
+ Collections.sort(combinedList);
assertEquals(combinedList, result);
assertThrows(NullPointerException.class, () -> FluentIterable.of(iterableOdd).zip((Iterable<Integer>) null).toList(),
(commons-collections) 05/06: Use if-else
Posted by gg...@apache.org.
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
commit 1364973ff27df9cebfc386e7910ff25ba54de596
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:21:55 2024 -0400
Use if-else
---
.../commons/collections4/sequence/SequencesComparator.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
index f1ec95659..3a1fc25b0 100644
--- a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
+++ b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
@@ -195,14 +195,12 @@ public class SequencesComparator<T> {
script.append(new KeepCommand<>(sequence1.get(i)));
++i;
++j;
+ } else if (end1 - start1 > end2 - start2) {
+ script.append(new DeleteCommand<>(sequence1.get(i)));
+ ++i;
} else {
- if (end1 - start1 > end2 - start2) {
- script.append(new DeleteCommand<>(sequence1.get(i)));
- ++i;
- } else {
- script.append(new InsertCommand<>(sequence2.get(j)));
- ++j;
- }
+ script.append(new InsertCommand<>(sequence2.get(j)));
+ ++j;
}
}
(commons-collections) 04/06: Remove unnecessary keyword
Posted by gg...@apache.org.
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
commit 0e3f2d3de510eac3a48b20c3c5d7ab84b91860b4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 23 14:21:46 2024 -0400
Remove unnecessary keyword
---
.../apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
index 24a143b85..9bbb2ed51 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
@@ -113,7 +113,7 @@ public class LayeredBloomFilterTest extends AbstractBloomFilterTest<LayeredBloom
@Override
public TimestampedBloomFilter copy() {
- return new TimestampedBloomFilter(this.getWrapped().copy(), timestamp);
+ return new TimestampedBloomFilter(getWrapped().copy(), timestamp);
}
public long getTimestamp() {