回归收藏

时间:2016-03-31 18:21:54

标签: java collections

我需要返回一个接受Connection类的集合,但它会一直返回一个错误,说"找不到符号"。我对如何返回集合缺乏了解。取站的参数。

这是方法:

<div id="divDeathOccurred" class="fieldRow">
   <div class="leftLabel labelWidth22">
     <label for="">A. Has a death occurred?</label>
   </div>
   <div class="leftField">
   <div class="formField34">
     <input id="rbDeathOccurred" name="rbDeathOccurred" type="radio" 
      class="radiobuttonfield" alt="Death Occurred" title="Death Occurred" 
      value="Yes" onclick="javascript:USAYesNoCheckDO();" />Yes
     <input id="rbDeathOccurred" name="rbDeathOccurred" type="radio" 
      class="radiobuttonfield" alt="Death Occurred" title="Death Occurred" 
      value="No" onclick="javascript:USAYesNoCheckDO();" />No
    </div>
     </div>
    <p>&nbsp;</p>
    <div id="USADOYesNo" style="display:none">
    <ol type="a">
      <li>Is there a reasonable possibility that a device failure or 
         malfunction was a direct or indirect factor in the death? 
     <br>
      <input id="rbDOYesNo" name="rbDOYesNo" type="radio"  
       class="radiobuttonfield" alt="Yes - Reportable" title="Yes - 
       Reportable" value="Yes" 
        onclick="javascript:USDeviceFailure30Days();"/>Yes - Reportable    
       <input id="rbDOYesNo" name="rbDOYesNo" type="radio"
        class="radiobuttonfield" alt="No - Follow tree below" title="No -  
        Follow tree below" value="No" 
        onclick="javascript:USDeviceFailure30Days();"/>No
      <br><div id="reminder"></div>
     <input id="date30Days" type="text" />
     </li>
    </ol>
    </div>
    </div>

这是Connection类:

@Override
public Collection<Connection> getConnectionsFrom(Station station) {
    return Collection<Connection>(station);
}

1 个答案:

答案 0 :(得分:0)

作为如何修复getConnectionsFrom的示例,假设它实际上应该返回Collection,如上所述。

public Collection<Station> getConnectionsFrom(Station station)
{
   Collection<Station> connections = new ArrayList<>();
   connections.add(station);
   return connections;
}

但请注意,每次都会创建集合。您需要更加具体地了解您要解决的问题。