package org.jivesoftware.smack.util;

import java.util.Collection;
import java.util.Iterator;
import org.jivesoftware.smack.packet.ExtensionElement;

public class PacketUtil {
   /** @deprecated */
   @Deprecated
   public static <PE extends ExtensionElement> PE packetExtensionfromCollection(Collection<ExtensionElement> collection, String element, String namespace) {
      return extensionElementFrom(collection, element, namespace);
   }

   public static <PE extends ExtensionElement> PE extensionElementFrom(Collection<ExtensionElement> collection, String element, String namespace) {
      Iterator i$ = collection.iterator();

      ExtensionElement packetExtension;
      do {
         do {
            if (!i$.hasNext()) {
               return null;
            }

            packetExtension = (ExtensionElement)i$.next();
         } while(element != null && !packetExtension.getElementName().equals(element));
      } while(!packetExtension.getNamespace().equals(namespace));

      return packetExtension;
   }
}
