This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 17efdd33627ef7f08826989ba85f65fb81708a26 Author: Gary Gregory <[email protected]> AuthorDate: Sun Jun 14 21:21:58 2026 +0000 Use ternary expression --- .../apache/commons/collections4/MultiMapUtils.java | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/MultiMapUtils.java b/src/main/java/org/apache/commons/collections4/MultiMapUtils.java index eb76759fa..5b42e9278 100644 --- a/src/main/java/org/apache/commons/collections4/MultiMapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MultiMapUtils.java @@ -86,10 +86,7 @@ public class MultiMapUtils { * @return the Collection in the {@link MultiValuedMap}, or null if input map is null. */ public static <K, V> Collection<V> getCollection(final MultiValuedMap<K, V> map, final K key) { - if (map != null) { - return map.get(key); - } - return null; + return map != null ? map.get(key) : null; } /** @@ -102,10 +99,7 @@ public class MultiMapUtils { * @return a new Bag containing the values from the {@link MultiValuedMap}, or null if input map is null. */ public static <K, V> Bag<V> getValuesAsBag(final MultiValuedMap<K, V> map, final K key) { - if (map != null) { - return new HashBag<>(map.get(key)); - } - return null; + return map != null ? new HashBag<>(map.get(key)) : null; } /** @@ -118,10 +112,7 @@ public class MultiMapUtils { * @return a new List containing the values from the {@link MultiValuedMap}, or null if input map is null. */ public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { - if (map != null) { - return new ArrayList<>(map.get(key)); - } - return null; + return map != null ? new ArrayList<>(map.get(key)) : null; } /** @@ -134,10 +125,7 @@ public class MultiMapUtils { * @return a new Set containing the values from the {@link MultiValuedMap}, or null if input map is null. */ public static <K, V> Set<V> getValuesAsSet(final MultiValuedMap<K, V> map, final K key) { - if (map != null) { - return new HashSet<>(map.get(key)); - } - return null; + return map != null ? new HashSet<>(map.get(key)) : null; } /**
