Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sudhee_Maximus
Creator

Java code new ArrayList<String> having errors while compiling....

Hi Friends ,

I have below code in tjavarow written and it throws error at new ArrayList which works fine in eclipse ...

my requirement is to create json structure with in java for each array element and put it in to an json array structure.

 

String str = input_row.Lang_Str;
String[] array = str.split("\"\"");
//String[] output = new String[array.length];
List<String> output = new ArrayList<String>();
for(int i=0; i<array.length; i++) {
String sqlString = "languageTypeCd:"+array[i]+",providerSpeaksInd:null";
output.add(sqlString);
}
String finalString = "";
for (String string : output) {
if(finalString.equals("")) {
finalString = finalString + string;
}
else {
finalString = finalString +","+ string;
}
}
System.out.println(finalString);


output_row.Len = input_row.Len;
output_row.Lang_Str = finalString;

Labels (2)
1 Solution

Accepted Solutions
Sudhee_Maximus
Creator
Author

hey uzix thanks for the reply , this issue got resloved .
the import was available but some how it was not working ...

 

java.util.List<String> output = new java.util.ArrayList<String>(); in the code which worked fine for me  🙂 .

View solution in original post

2 Replies
uzix
Creator

hello,

 

in tjavarow , you have declared  the import ?

->tjavarow  > advanced settings

import java.util.ArrayList;

Sudhee_Maximus
Creator
Author

hey uzix thanks for the reply , this issue got resloved .
the import was available but some how it was not working ...

 

java.util.List<String> output = new java.util.ArrayList<String>(); in the code which worked fine for me  🙂 .