2

次のメソッドがあり、最後のエントリを返すようになりましたが、注釈のリストを送信するにはどうすればよいですか?

ループからすべての注釈リストを返したい

public EList<Annotation> getAnnotation()
{
  EList<Annotation> annotations = null;
  for (Sc currSc : sche)
  {
    for (EntityS entitys : ent)
    {
      // Get annotation
      annotations = entitys.getAnnotations();
    }
  }
  return annotations;
}
4

1 に答える 1

3

すべての をまとめようとしている場合はAnnotation、まったく新しい を作成してから、EListそれらをすべて追加する必要があります。

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;
}
于 2012-11-29T14:36:43.287 に答える