We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › java.util.List error message
Page Index Toggle Pages: 1
java.util.List error message (Read 888 times)
java.util.List error message
Nov 8th, 2007, 5:36am
 
Hi there,

I am studying about using proHtml. when I run a example file in URL folder, I got a error message.

This is a example file I opend

import prohtml.*;

HtmlTree htmlTree;

void setup(){
 //enter your url here
 htmlTree = new HtmlTree("http://www.yoururl.com");

 ArrayList links = htmlTree.getLinks();

 for(int i = 0;i<links.size();i++){
   println("**********************************************");
   println("Url_"+nf(i,3)+" : "+
     ((Url)(links.get(i))).toString());
   println(" getCompleteUrl: "+
     ((Url)(links.get(i))).getCompleteUrl());
   println(" getDomain : "+
     ((Url)(links.get(i))).getDomain());
   println(" getParentPart : "+
     ((Url)(links.get(i))).getParentPart());
   println(" getUrl : "+
     ((Url)(links.get(i))).getUrl());
   println(" isAbsolute : "+
     ((Url)(links.get(i))).isAbsolute());
 }
}

and then, I got a this message.

The type of the right sub-expression, "java.util.List", is not assignable to the variable, of type "java.util.ArrayList".

So, I tried to find websits and reference about ArrayList in java. But I could not work out this problem. Do you have any suggestion or comment to this error?

TH


Re: java.util.List error message
Reply #1 - Nov 8th, 2007, 8:11am
 
see proHTML reference : the getList() method returns a List, not an ArrayList. you have to write, line 9 :

Code:
List links = htmlTree.getLinks(); 

Page Index Toggle Pages: 1