Search the MessageML tree (depth-first) for elements of a given type.
@param type the class of elements to find
@return found elements
960802
public List<Element> findElements(Class<?> type) {
    List<Element> result = new ArrayList<>();
    LinkedList<Element> stack = new LinkedList<>(this.getChildren());

    if (this.getClass() == type) {
      result.add(this);
    }

    while (!stack.isEmpty()) {
      Element child = stack.pop();
      stack.addAll(0, child.getChildren());
      if (child.getClass() == type) {
        result.add(child);
      }
    }

    return result;
  }
1007728
public static DynamicMessage getDefaultInstance(final Descriptor type) {
    return wrap(com.google.protobuf.DynamicMessage.getDefaultInstance(type));
  }
350295
public JClassType getType( String type ) throws UnableToCompleteException {
        try {
            return typeOracle.getType( type );
        } catch ( NotFoundException e ) {
            logger.log( TreeLogger.ERROR, "TypeOracle could not find " + type );
            throw new UnableToCompleteException();
        }
    }
277373
@Nullable static VariableElement findCreator(Elements elements, Types types, TypeMirror type) {
    if (type.getKind() != TypeKind.DECLARED) {
      return null;
    }
    DeclaredType declaredType = (DeclaredType) type;
    TypeElement typeElement = (TypeElement) declaredType.asElement();
    return findCreator(elements, types, typeElement);
  }
1121629
public <T> Map<String, T> findByTypeWithName(Class<T> type) {
        return applicationContext.getBeansOfType(type);
    }
941647
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setType(final String type) {
        pathBuilder.setType(type);
        return (T) this;
    }
82219
public List<Element> findElements(String tag) {
    List<Element> result = new ArrayList<>();
    LinkedList<Element> stack = new LinkedList<>(this.getChildren());

    if (tag.equalsIgnoreCase(this.getMessageMLTag())) {
      result.add(this);
    }

    while (!stack.isEmpty()) {
      Element child = stack.pop();
      stack.addAll(0, child.getChildren());
      if (tag.equalsIgnoreCase(child.getMessageMLTag())) {
        result.add(child);
      }
    }

    return result;
  }
410310
@SuppressWarnings("unchecked")
    public static List<Class<?>> getSupertypes(Class<?> type) {
        List<Class<?>> supertypes = new LinkedList<>();
        supertypes.add(type.getSuperclass());
        Collections.addAll(supertypes, type.getInterfaces());
        return supertypes;
    }
1067246
def getElementsByType(self, type):
        
        foundElements=[]
        for element in self.getAllElementsOfHirarchy():
            if isinstance(element, type):
                foundElements.append(element)                
                
        return foundElements
155443
public boolean containsOfType(final Class<? extends Tag> type) {
	read.lock();
	try {
	    return tags.containsKey(type);
	} finally {
	    read.unlock();
	}
    }
149520
public static <T> TypeChecker<List<? extends T>> tList(Class<? extends T> elementType) {
        return tList(tSimple(elementType));
    }
339299
public String getTreeSite(String type) {

        String result = m_treeSite.get(type);
        return result;
    }
138963
public static MethodNode findSAM(ClassNode type) {
        if (!Modifier.isAbstract(type.getModifiers())) return null;
        if (type.isInterface()) {
            List<MethodNode> methods = type.getMethods();
            MethodNode found=null;
            for (MethodNode mi : methods) {
                // ignore methods, that are not abstract and from Object
                if (!Modifier.isAbstract(mi.getModifiers())) continue;
                // ignore trait methods which have a default implementation
                if (Traits.hasDefaultImplementation(mi)) continue;
                if (mi.getDeclaringClass().equals(OBJECT_TYPE)) continue;
                if (OBJECT_TYPE.getDeclaredMethod(mi.getName(), mi.getParameters())!=null) continue;

                // we have two methods, so no SAM
                if (found!=null) return null;
                found = mi;
            }
            return found;

        } else {

            List<MethodNode> methods = type.getAbstractMethods();
            MethodNode found = null;
            if (methods!=null) {
                for (MethodNode mi : methods) {
                    if (!hasUsableImplementation(type, mi)) {
                        if (found!=null) return null;
                        found = mi;
                    }
                }
            }
            return found;
        }
    }
607903
public String getTreeResource(String type) {

        String result = m_treeType.get(type);
        if (result == null) {
            result = "/";
        }
        return result;
    }
370323
public List<ResourceHandle> getChildrenByType(final String type) {
        final ArrayList<ResourceHandle> children = new ArrayList<>();
        if (this.isValid()) {
            for (final Resource child : this.resource.getChildren()) {
                ResourceHandle handle = ResourceHandle.use(child);
                if (handle.isOfType(type)) {
                    children.add(handle);
                }
            }
        }
        return children;
    }
525072
private Content getTreeForClassHelper(TypeMirror type) {
        Content li = new HtmlTree(HtmlTag.LI);
        if (type.equals(typeElement.asType())) {
            Content typeParameters = getTypeParameterLinks(
                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
                    typeElement));
            if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
                li.addContent(utils.asTypeElement(type).getSimpleName());
                li.addContent(typeParameters);
            } else {
                li.addContent(utils.asTypeElement(type).getQualifiedName());
                li.addContent(typeParameters);
            }
        } else {
            Content link = getLink(new LinkInfoImpl(configuration,
                    LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
                    .label(configuration.getClassName(utils.asTypeElement(type))));
            li.addContent(link);
        }
        return li;
    }
1335147
private static Class<?> searchIntoParameterzedType(final Type superType, final Class<?> typeSearched) {
        if (superType instanceof ParameterizedType) {
            for (final Type genericType : ((ParameterizedType) superType).getActualTypeArguments()) {
                if (genericType instanceof Class<?> && typeSearched.isAssignableFrom((Class<?>) genericType)) {
                    return (Class<?>) genericType;
                } else if (genericType instanceof ParameterizedType && typeSearched.isAssignableFrom((Class<?>) ((ParameterizedType) genericType).getRawType())) {
                    return (Class<?>) ((ParameterizedType) genericType).getRawType();
                }
            }
        }
        return null;
    }