/**
 *
 * Copyright © 2014 Florian Schmaus
 *
 * Licensed 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 org.jivesoftware.smack.util;

import java.util.Collection;

import org.jivesoftware.smack.packet.ExtensionElement;

public class PacketUtil {

    /**
     * Get a extension element from a collection.
     * @param collection TODO javadoc me please
     * @param element TODO javadoc me please
     * @param namespace TODO javadoc me please
     * @param <PE> the type of the extension element.
     * @return the extension element
     * @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead.
     */
    @Deprecated
    public static <PE extends ExtensionElement> PE packetExtensionfromCollection(
            Collection<ExtensionElement> collection, String element,
            String namespace) {
        return extensionElementFrom(collection, element, namespace);
    }

    /**
     * Get a extension element from a collection.
     *
     * @param collection Collection of ExtensionElements.
     * @param element name of the targeted ExtensionElement.
     * @param namespace namespace of the targeted ExtensionElement.
     * @param <PE> Type of the ExtensionElement
     *
     * @return the extension element
     * @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead
     */
    @Deprecated
    public static <PE extends ExtensionElement> PE packetExtensionFromCollection(
                    Collection<ExtensionElement> collection, String element,
                    String namespace) {
        return extensionElementFrom(collection, element, namespace);
    }

    /**
     * Get a extension element from a collection.
     *
     * @param collection Collection of ExtensionElements.
     * @param element name of the targeted ExtensionElement.
     * @param namespace namespace of the targeted ExtensionElement.
     * @param <PE> Type of the ExtensionElement
     *
     * @return the extension element
     */
    @SuppressWarnings("unchecked")
    public static <PE extends ExtensionElement> PE extensionElementFrom(Collection<ExtensionElement> collection,
                    String element, String namespace) {
        for (ExtensionElement packetExtension : collection) {
            if ((element == null || packetExtension.getElementName().equals(
                            element))
                            && packetExtension.getNamespace().equals(namespace)) {
                return (PE) packetExtension;
            }
        }
        return null;
    }
}

@@ -19,16 +19,21 @@
 t %C2%A9 2014
+-2020
  Florian
@@ -41,16 +41,16 @@
 Schmaus%0A
-
  *%0A * Li
@@ -727,16 +727,16 @@
 ement;%0A%0A
+
 public c
@@ -758,1402 +758,8 @@
  %7B%0A%0A
-    /**%0A     * Get a extension element from a collection.%0A     * @param collection TODO javadoc me please%0A     * @param element TODO javadoc me please%0A     * @param namespace TODO javadoc me please%0A     * @param %3CPE%3E the type of the extension element.%0A     * @return the extension element%0A     * @deprecated use %7B@link #extensionElementFrom(Collection, String, String)%7D instead.%0A     */%0A    @Deprecated%0A    public static %3CPE extends ExtensionElement%3E PE packetExtensionfromCollection(%0A            Collection%3CExtensionElement%3E collection, String element,%0A            String namespace) %7B%0A        return extensionElementFrom(collection, element, namespace);%0A    %7D%0A%0A    /**%0A     * Get a extension element from a collection.%0A     *%0A     * @param collection Collection of ExtensionElements.%0A     * @param element name of the targeted ExtensionElement.%0A     * @param namespace namespace of the targeted ExtensionElement.%0A     * @param %3CPE%3E Type of the ExtensionElement%0A     *%0A     * @return the extension element%0A     * @deprecated use %7B@link #extensionElementFrom(Collection, String, String)%7D instead%0A     */%0A    @Deprecated%0A    public static %3CPE extends ExtensionElement%3E PE packetExtensionFromCollection(%0A                    Collection%3CExtensionElement%3E collection, String element,%0A                    String namespace) %7B%0A        return extensionElementFrom(collection, element, namespace);%0A    %7D%0A%0A
     

remove deprecated methods in PacketUtil