Alright, for convenience, I made a subclass of NSMutableArray called NSMSArray (Next Step Mutable String Array). Now, all you other Coco-Java developers, try compiling this and making an instance of NSMSArray with the the static method arrayWithTokenizer.
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;
import java.util.StringTokenizer;
public class NSMSArray extends NSMutableArray
{
public static NSMSArray arrayWithTokenizer(StringTokenizer a)
{
String[] array = new String[a.countTokens()];
for(int i=<font color = blue>0</font>; i<array.length; i++) array[i] = a.nextToken();
return new NSMSArray(array);
}
public NSMSArray(Object[] a)
{
super(a);
}
public String stringAtIndex(int i)
{
return (String)this.objectAtIndex(i);
}
public String combinedString()
{
int count = this.count();
String answer = <font color = red>""</font>;
for(int i=<font color = blue>0</font>; i<count; i++) answer+=this.stringAtIndex(i);
return answer;
}
}
</font>[/code]
Notice this:
NSInvalidArgumentException: *** initialization method -initWithObjects:count: cannot be sent to an abstract object of class NSMSArray: Create a concrete instance!
After noticing this, does anyone know why this is happening or how I could fix the problem?
Thanks,
F-bacher