public class test 
{   public static void main(String[] args)
{
String arr[]=new String[2];
arr[0]="txt_com3.txt";
arr[1]="txt_com4.txt";
FilesList mylist=new FilesList(arr);
SequenceInputStream sin;
int date;
try{
sin=new SequenceInputStream(mylist);
while((date=sin.read())!=-1)
System.out.print((char)date);
sin.close();
}catch(FileNotFoundException e){System.out.println("no found");}
catch(IOException e){}
}
}class FilesList implements Enumeration
{
String MyFilesList[];
int count=0;
public FilesList(String fileslist[])
{
this.MyFilesList=fileslist;
}
public boolean hasMoreElements()
{
if(count<MyFilesList.length)
return true;
else
return false;
} public Object nextElement()
{
InputStream in=null;
if(!hasMoreElements())
throw new NoSuchElementException("no found files");
else
{
String s=MyFilesList[count];
count++;
try{
in=new FileInputStream(s);
}catch(FileNotFoundException e){System.out.println("no found");}
}
return in;
}
}

解决方案 »

  1.   

    可以不管,如果用eclipse可以帮你添加转换
      

  2.   

    using @SuppressWarnings("unchecked") annotation if you are so sure about type-safty of your collection. otherwise, taking generic collection instead,which seems good practice to me.BTW, it's not IDE's job to do code tranforming,it's complier:called erasing and casting.
    And raw type collection actually is a serious problem: run-time type checking is error-prone.