EOEntity[] entities = (EOEntity[]) entitiesList.toArray(new EOEntity[entitiesList.size()]); Arrays.sort(entities, new ReflectionComparator(EOEntity.class, "getName"));
List entitiesListCopy = new LinkedList(); entitiesListCopy.addAll(entitiesList); Collections.sort(entitiesListCopy, new ReflectionComparator(EOEntity.class, "getName")); if (myAllowBlank) { entitiesListCopy.add(0, EOEntityListContentProvider.BLANK_ENTITY); } Object[] entities = entitiesListCopy.toArray();
  public Object[] getElements(Object _inputElement) {    List entitiesList;    if (_inputElement instanceof EORelationship) {      if (myRestrictToSingleModel) {        entitiesList = ((EORelationship) _inputElement).getEntity().getModel().getEntities();      }      else {        entitiesList = ((EORelationship) _inputElement).getEntity().getModel().getModelGroup().getEntities();      }    }    else if (_inputElement instanceof EOEntity) {      if (myRestrictToSingleModel) {        entitiesList = ((EOEntity) _inputElement).getModel().getEntities();      }      else {        entitiesList = ((EOEntity) _inputElement).getModel().getModelGroup().getEntities();      }    }    else if (_inputElement instanceof EOModel) {      if (myRestrictToSingleModel) {        entitiesList = ((EOModel) _inputElement).getEntities();      }      else {        entitiesList = ((EOModel) _inputElement).getModelGroup().getEntities();      }    }    else if (_inputElement instanceof EOModelGroup) {      entitiesList = ((EOModelGroup) _inputElement).getEntities();    }    else {      throw new IllegalArgumentException("Unknown input element: " + _inputElement);    }    EOEntity[] entities = (EOEntity[]) entitiesList.toArray(new EOEntity[entitiesList.size()]);    Arrays.sort(entities, new ReflectionComparator(EOEntity.class, "getName"));    return entities;  }