Пример #1
0
 @Nullable
 public <T> T findChildByClass(Class<T> aClass) {
   for (PsiElement child : getChildren()) {
     if (aClass.isInstance(child)) return (T) child;
   }
   return null;
 }
Пример #2
0
 @NotNull
 public <T> T[] findChildrenByClass(Class<T> aClass) {
   List<T> result = new ArrayList<T>();
   for (PsiElement child : getChildren()) {
     if (aClass.isInstance(child)) result.add((T) child);
   }
   return result.toArray((T[]) Array.newInstance(aClass, result.size()));
 }