I have an array of objects that can have the content string of each array element, or else there will be another array with strings May be. Or they can be arrays of arrays that catch the string. Object obj2 = array [str1, str2] or
Example:
object obj1 = array [[str1, str2, str3], [str4, str5]] or: Object obj3 = "this string" I need a method that takes this object as a logic, and if it is one of the first two cases, then those elements With an array removed and if it is the last case, then it gives an array with a single string element which came in the form of the Ultimate.
So, if I get
getDataForColumn (obj1) I: [Str1, str2 Str3 .... str5] getDataForColumn (obj2) I get the array: Like [str1, str2] // input, I know that getDataForColumn (obj3) I get the array: ["this string"] I'm trying, but I really Can not wrap your head how to do it with repetition, nor is it possible, at least in this way.
This is what came with me, and (object []) [object] [castarray = (object []) column; [Static]
Private static object [] getDataForColumn (object column) object [] NewArray = New Object [CastArereline]; For (int i = 0; i & lt; castarray.length; i ++) {if ([castarray [i] example means []) {// recursion, but how: D} and {newArray [i] = CastArray [i];}} Return the new arrays;} Return a new array with the object that ....... got help.Thanks
This is an easy way to do this. I use the list because I like it on arrays, but definitely By form you can create a cover which will eventually convert it into an array:
Public Stable List & lt; String & gt; Flat (object o) {List & quot; string> String = New Arreelist & lt; string & gt; (); If (o.getClass ( ). IsArray ()} {Object [] ORR = (object []) for o (object obj: oarr) {strings.addAll (flat (obj)}}} and {string.ed (o.stustring ( ));} Return string;}
Comments
Post a Comment