code: @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;
      }
docs: 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