public <Psi extends PsiElement> Psi[] getStubOrPsiChildren(TokenSet filter, ArrayFactory<Psi> f) {
   T stub = myStub;
   if (stub != null) {
     //noinspection unchecked
     return (Psi[]) stub.getChildrenByType(filter, f);
   } else {
     final ASTNode[] nodes = getNode().getChildren(filter);
     Psi[] psiElements = f.create(nodes.length);
     for (int i = 0; i < nodes.length; i++) {
       psiElements[i] = (Psi) nodes[i].getPsi();
     }
     return psiElements;
   }
 }
 public <Stub extends StubElement, Psi extends PsiElement> Psi[] getStubOrPsiChildren(
     final IStubElementType<Stub, Psi> elementType, ArrayFactory<Psi> f) {
   T stub = myStub;
   if (stub != null) {
     //noinspection unchecked
     return (Psi[]) stub.getChildrenByType(elementType, f);
   } else {
     final ASTNode[] nodes = SharedImplUtil.getChildrenOfType(getNode(), elementType);
     Psi[] psiElements = f.create(nodes.length);
     for (int i = 0; i < nodes.length; i++) {
       psiElements[i] = (Psi) nodes[i].getPsi();
     }
     return psiElements;
   }
 }
 @NotNull
 public static PsiType[] createArray(int count) {
   return ARRAY_FACTORY.create(count);
 }