@HIFI_APPS what result will the arrayer return?
You're parsing them to Integer
. If you put a list with characters then you will get an error.
edited post
Only example it will convert not return
How can you save String data in int array
Please test you're code before posting it.
I can't in mobile but re edited
Again . How can you assign int array value to string array?
Array and ArrayList are different.
This should work fine:
List list = new ArrayList<>();
String[] sArray = yailList.toStringArray();
for (String s:sArray){
list.add(s);
}
list.remove(index - 1);//now you can add and remove items
@SimpleFunction
public void Example(YailList list) {
Object[] arrayer = new Object[list.size()];
int index = 0;
for(Object e : list.toArray()) {
arrayer[index] = e;
index++;
}
}
Try this for all type of things to array
The object
must be Object
btw, what's the point of adding index++
@vknow360 i edited yes will it work
List list = new ArrayList<>();
Object[] sArray = yailList.toArray();
for (Object s:sArray){
list.add(s);
}
And
(String) s
To convert to string ...
#Off topic
Yes I need to learn actually I copy pasted
Ur post
...
Really sorry if i am annoying.
Please correct the object
to Object
.
Which IDE do you use?
It's okay but should first test everything.
Thank you for the code that you share @vknow360,
I've tried it and your code 100% works perfectly.
This is the code I've tried :
@SimpleFunction(description="")
public YailList RemoveItem(YailList yailList, int index){
List list = new ArrayList<>();
String[] sArray = yailList.toStringArray();
for (String s:sArray){
list.add(s);
}
list.remove(index - 1);//now you can add and remove items
return YailList.makeList(list);
}
I know it is only an example, but...
Taifun