Java 列表的返回方法列表

Java 列表的返回方法列表,java,Java,我有下面的方法,现在返回最后一个条目,但是 如何发送注释列表 我想返回循环中的所有注释列表 public EList<Annotation> getAnnotation() { EList<Annotation> annotations = null; for (Sc currSc : sche) { for (EntityS entitys : ent) { // Get annotation annotations

我有下面的方法,现在返回最后一个条目,但是 如何发送注释列表

我想返回循环中的所有注释列表

public EList<Annotation> getAnnotation()
{
  EList<Annotation> annotations = null;
  for (Sc currSc : sche)
  {
    for (EntityS entitys : ent)
    {
      // Get annotation
      annotations = entitys.getAnnotations();
    }
  }
  return annotations;
}
public EList getAnnotation()
{
EList注释=null;
对于(Sc currSc:sche)
{
for(EntityS EntityS:ent)
{
//获取注释
annotations=entitys.getAnnotations();
}
}
返回注释;
}

如果您试图将所有
注释
放在一起,则需要创建一个全新的
列表
,然后将它们全部添加,即

public EList<Annotation> getAnnotation()
{
  // Create the new list that will hold ALL the annotations
  EList<Annotation> annotations = new BasicEList<Annotation>();
  for (Sc currSc : sche)
  {
    for (EntityS entitys : ent)
    {
      // Get annotation
      annotations.addAll(entitys.getAnnotations());
    }
  }
  return annotations;
}
public EList getAnnotation()
{
//创建包含所有注释的新列表
EList annotations=新巴塞尔主义者();
对于(Sc currSc:sche)
{
for(EntityS EntityS:ent)
{
//获取注释
addAll(entitys.getAnnotations());
}
}
返回注释;
}

你到底想做什么?问题出在哪里?
annotations.addAll
当我尝试放置EList annotations=new EList()时;我得到一个错误,无法实例化类型EList(),有什么想法吗?顺便说一句,我注意到我在import org.eclipse.emf.common.util.EList;但问题仍然存在。@FedorE:你在使用吗?没有,因为当我使用它时,我出现了错误…我尝试了CRTL+SHIFT+O,但问题仍然存在…也许你认为有其他方法可以解决这个问题吗?让我们来看看