Iterator next import class?
Hi.
I am creating a java applet, but I dont think I am importing the correct classes:
Code :
import java.applet.*;
import java.io.*;
import java.net.*;
import java.awt.event.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.*;
import java.util.ListIterator;
import java.util.List;
Map<String, List<String>> headers = connection.getHeaderFields();
List<String> values = headers.get("Set-Cookie");
String cookieValue = null;
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
String v = values.next();
if (cookieValue == null)
cookieValue = v;
else
cookieValue = cookieValue + ";" + v;
}
error:
httpc.java:180: cannot find symbol
symbol : method next()
location: interface java.util.List<java.lang.String>
String v = values.next();
Which class am I missing? thanks.
Re: Iterator next import class?
Um, you need to review how to set up a class. If this is your entire code, you should have a look at how to declare a class (not one your importing, but the one you are creating) and really the basics of JAVA in general. I don't even know how to help you with this.
Re: Iterator next import class?
This is not my entire code!
I only included the relevant snippets, these two line in particular are not working:
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
String v = values.next();
Re: Iterator next import class?
Code :
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
String v = iter.next();
Re: Iterator next import class?
Re: Iterator next import class?
Fixed the error with:
Code :
String v = iter.next().toString();
I assumed the code would work because it was directly taken from Cookie Support.
Thanks for the help, much appreciated