[java-support] branch master updated: JSPT-92 Remove CollectionSupport

Rod Widdowson rdw at steadingsoftware.com
Sat Nov 2 11:49:40 EDT 2019


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=5c941072d52512efce4217ad6cb1093d1901c1ad

The following commit(s) were added to refs/heads/master by this push:
       new  5c94107   JSPT-92 Remove CollectionSupport
5c94107 is described below

commit 5c941072d52512efce4217ad6cb1093d1901c1ad
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Nov 2 11:38:43 2019 +0000

    JSPT-92 Remove CollectionSupport
    
    https://issues.shibboleth.net/jira/browse/JSPT-92
---
 .../java/support/collection/CollectionSupport.java | 124 ---------------------
 1 file changed, 124 deletions(-)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java
deleted file mode 100644
index dc7df66..0000000
--- a/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.utilities.java.support.collection;
-
-import java.util.Collection;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import net.shibboleth.utilities.java.support.logic.Constraint;
-
-/** Helper methods for working with collections of objects. */
-public final class CollectionSupport {
-
-    /** Constructor. */
-    private CollectionSupport() {
-
-    }
-
-    /**
-     * Adds an element to a collection if it meets the requirements of a given predicate.
-     * 
-     * @param <T> type of element in the collection
-     * @param target collection to which elements will be added
-     * @param element element that may be added to the collection
-     * @param predicate predicate the given element must meet in order to be added to the given collection
-     * 
-     * @return true if the given element was added to the given collection
-     */
-    public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final T element,
-            @Nonnull final Predicate<? super T> predicate) {
-        return addIf(target, element, predicate, t -> t);
-    }
-
-    /**
-     * Adds an element to a collection if it meets the requirements of a given predicate.
-     * 
-     * @param <T> type of element in the collection
-     * @param target collection to which elements will be added
-     * @param element element that may be added to the collection
-     * @param predicate predicate the given element must meet in order to be added to the given collection
-     * @param elementPreprocessor function applied to element prior to predicate evaluation and being added the
-     *            collection
-     * 
-     * @return true if the given element was added to the given collection
-     */
-    public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final T element,
-            @Nonnull final Predicate<? super T> predicate, @Nonnull final Function<? super T, T> elementPreprocessor) {
-        Constraint.isNotNull(target, "Target collection can not be null");
-        Constraint.isNotNull(predicate, "Element predicate can not be null");
-
-        if (element == null) {
-            return false;
-        }
-
-        final T processedElement = elementPreprocessor.apply(element);
-        if (predicate.test(processedElement)) {
-            return target.add(processedElement);
-        }
-
-        return false;
-    }
-
-    /**
-     * Adds a collection of elements to a collection for each element that meets the requirements of a given predicate.
-     * 
-     * @param <T> type of element in the collection
-     * @param target collection to which elements will be added
-     * @param elements elements that may be added to the collection
-     * @param predicate predicate the given element must meet in order to be added to the given collection
-     * 
-     * @return true if the given target had elements added to it
-     */
-    public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final Collection<T> elements,
-            @Nonnull final Predicate<? super T> predicate) {
-        return addIf(target, elements, predicate, t -> t);
-    }
-
-    /**
-     * Adds a collection of elements to a collection for each element that meets the requirements of a given predicate.
-     * 
-     * @param <T> type of element in the collection
-     * @param target collection to which elements will be added
-     * @param elements elements that may be added to the collection
-     * @param predicate predicate the given element must meet in order to be added to the given collection
-     * @param elementPreprocessor function applied to element prior to predicate evaluation and being added the
-     *            collection
-     * 
-     * @return true if the given target had elements added to it
-     */
-    public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final Collection<T> elements,
-            @Nonnull final Predicate<? super T> predicate, @Nonnull final Function<? super T, T> elementPreprocessor) {
-        if (elements == null) {
-            return false;
-        }
-
-        boolean targetedUpdated = false;
-        for (final T element : elements) {
-            if (addIf(target, element, predicate, elementPreprocessor)) {
-                targetedUpdated = true;
-            }
-        }
-
-        return targetedUpdated;
-    }
-
-}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list