java - Converting Lists of Lists into String array -
I want to change the list's lists into two different string arrays.
I type the tag array in the string array tagar [] and tokenist in the array named Tokeny .
I have tried many ways to change but there are several ways to change converting an ArrayList to 2D array but I list of lists Strong> Any string to convert to string array can not be found. Anyone can help me do this.
Tag list
[[non, non], [non, non], [non, non, non], non, non ], [ENTI, ENTI]]
tokenist
[[John, ran], [john, jump] [The dog, jump], [Mary, SAT], [Finland, India]]
I tried the following methods
for (int I = 0; i & lt; tokenlist.size (); i ++) {string [] word = tokenlist.get (i); }
When I use the above method I am getting the output but the problem is that I have to take the same tokenlist and tag list at the same time.
I have to convert it to a 3D array with the following format <[/]> [last] string [] [] [] WORDS_TAGS = new string [] [] [] {{" John "," Run "}, {" non "," non "}," "", "non", "non", "non", "non", {{"John", "jump"} , {"Non", "non"}, {{"}", "{", "ENTTY", "ENTTY"}},
}
try it
list & lt; List & lt; String & gt; & Gt; Arrays.asList ("non", "non"), arrays.asList ("non", "non"), arrays.asList ("non", "non", "non"), arrays. SLIIS ("non", "non"), eraseus. List ("ENTTY", "ENTTY"); & Lt; From the list & lt; String & gt; & Gt; ARA ASLIIS ("John", "Run"), Erezas.list ("John", "Jump"), Arrays. SLIIS ("The", "Dog", "Jump" ), Arrays .slist ("Mary", "Saturn"), Arrays.Sistlist ("Finland", "India")); String [] [] [] A = new string [l1.size ()] [] []; (Int i = 0; i & lt; l1.size (); i ++) {a [i] = new string [] [] {l2.get (i) .toArray (new string [l2.get (I) size ()]), l1.get (i) .toArray (new string [l1.get (i) .ize ()])}} } System.out.println (Arrays.deepToString (a));
output
[[[John, ran], [non, non]], [[John, jump], [non, non]] [[Dog, jump], [non, non, non]], [[Mary, Saturn], [non, non]], [[Finland, India], [ENTIE, ENTI]]
/ Pre>
Comments
Post a Comment