Int value = new int{1,2,3,4,5};
I wnt to get number from YailList
How to get value from YailList any example code?
Int value = new int{1,2,3,4,5};
I wnt to get number from YailList
How to get value from YailList any example code?
You can use Object
something like this :
public String getValue(YailList list, String value)
{
for (Object a : list) {
if(a == value)
{
return (String) a;
}
}
return null;
}
Or
If you know the index, then use list.getString(index)
You want to number add from YailList to array?
Yes u r right
Have you tried with ArrayList?
Add all values from YailList to ArrayList, then ArrayList to Array
YailList to int array.
i try this but dint work
public Object[] YailListToArray(YailList list)
{
return list.toArray();
}
With ArrayList
public Object[] ArrayListToArray(YailList list)
{
return YailToArrayList(list).toArray();
}
public ArrayList<Object> YailToArrayList(YailList list)
{
ArrayList<Object> arrayList = new ArrayList<>();
for (Object a: list)
{
arrayList.add(a);
}
return arrayList;
}
I know this much, only now someone else can help you
Edit:
List to int array
int[] numbers = list.stream().mapToInt(i-> (int) i).toArray();
ok ill try this
thanks sumit its working now… and Shreyaa also for helping
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.