Liutauras Vilda wrote:You overlooked 2 things.
1. line 6. firstSplit is an array, not the string, so you need to split its element by accessing some in particular. i.e. firstSplit[x].split(...)
2. line 2. you don't know what the length going to be of the inner array as a result after the split. So you don't need to specify this length.
After fixing those 2 parts I get it working.
Stephan van Hulst wrote:You can also use Pattern.splitAsStream() in conjunction with Stream.flatMap():
Lisa Austin wrote:I am sorry if I missed something obvious here but I receive a Type mismatch when I try that.
Carey Brown wrote:Here I'm allocating space for N references to String arrays but I'm not declaring how many Strings will be in the String array nor am I allocating references to any String array at this point. That comes later in the loop.
Carey Brown wrote:
Carey Brown wrote:Here I'm allocating space for N references to String arrays but I'm not declaring how many Strings will be in the String array nor am I allocating references to any String array at this point. That comes later in the loop.
Carey Brown wrote:This case does not lend itself well to regular expressions. I've implement similar code many times in production code.
Carey Brown wrote:Essentially the same way you've done it except with some business logic sprinkled in.
Carey Brown wrote:Here's a simple example, using this technique to create a map of argument name-value pairs from a URL.
Output:
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |