我有一个包含解析 KML 文件并将结果保存到 ArrayList 变量中的方法的类。我已经从方法中打印了变量的内容,结果在方法中正确。然后我如何在另一堂课中使用这些结果?干杯乔恩
1 回答
            0        
        
		
就像下面这样:
public class YourClass{
   private List<yourType> list; 
   public void parseKML(){ //your method in which you are parsing KML file.
      ...
      ...
      list = new ArrayList<your type>();
      // and now save all variable in this list rather then saving it to local ArrayList
    ...
   }
  public List<yourtype> getKMLList(){
     // to Minimize mutibility Effective java item 15  
     return list.clone();  
   }
}  
    于 2013-04-15T11:30:54.467   回答