@NotNull public PsiQuery siblings(@NotNull final Class<? extends PsiNamedElement> clazz,@NotNull final String name){
  final List<PsiElement> result=new ArrayList<PsiElement>();
  for (  final PsiElement element : myPsiElements) {
    final PsiElement parent=element.getParent();
    for (    final PsiNamedElement namedSibling : PsiTreeUtil.findChildrenOfType(parent,clazz)) {
      if ((!namedSibling.equals(element)) && (name.equals(namedSibling.getName()))) {
        result.add(namedSibling);
      }
    }
  }
  return new PsiQuery(result.toArray(new PsiElement[result.size()]));
}

@ NotNull public PsiQuery siblings ( @ NotNull final Class < ? extends PsiNamedElement > clazz , @ NotNull final String name ) { final List < PsiElement > result = new ArrayList < PsiElement > ( ) ; for ( final PsiElement element : myPsiElements ) { final PsiElement parent = element . getParent ( ) ; for ( final PsiNamedElement namedSibling : PsiTreeUtil . findChildrenOfType ( parent , clazz ) ) { if ( ( ! namedSibling . equals ( element ) ) && ( name . equals ( namedSibling . getName ( ) ) ) ) { result . add ( namedSibling ) ; } } } return new PsiQuery ( result . toArray ( new PsiElement [ result . size ( ) ] ) ) ; }
filter siblings by name and class
