Upon compiling this, I get the note "iterates.java uses unchecked or unsafe operations"; "Recompile with -Xlint: unchecked for details". How can I resolve this?import java.util.*; public class iterates { private ArrayList<String> arrayOfString = new ArrayList(); private String input = "hui hello { q...} qdf qkfh youu"; private int n = 0; public static void main(String[] args) { iterates h = new iterates(); h.studyString(); } public void studyString() { String originalText = "Hello ther{e oops)eee"; arrayOfString = toArray(originalText); Iterator bitch = arrayOfString.iterator(); while (bitch.hasNext()) { if (bitch.next().equals('{') || bitch.next().equals('}')) { int i = arrayOfString.indexOf(bitch.next()); arrayOfString.add(i + 1, "<br>"); } } } public ArrayList<String> toArray(String input) { StringTokenizer pieces = new StringTokenizer(input); while (n <= pieces.countTokens()) { arrayOfString.add(n, pieces.nextToken()); } n++; return arrayOfString; } }
Note, I am trying to convert a random string (the code here has been slightly adjusted - this is in fact a stub of a class) to an arrayList<String>. If you have a better idea as to how I should do this, please let me know!
Thanks!