Iterate through nested List to return inner List by specified param












0















The goal is to return the inner list of Object with a given param from the data list. The layer on which this Object will be found may vary.



The pseudo code for the Object is



class Object {
var id: Int
var innerObjects: ArrayList<Object>
}


If innerObjects param is null then we reached the leaf.



We are given ArrayList<Object> which is the data and id we are searching for. The Object we search can be on any level of the list.



What I have now is this piece of code but it only checks for 2 levels of the list. Please, suggest a solution that would work for any number of levels in the list. Possibly with recursion.



private fun getObject(data: ArrayList<Object>, id: Int): ArrayList<Object> {
var result = ArrayList<Object>()
for (i in 0 until data.size) {
if (data[i].id == id) {
result = data[i].innerObjects
} else {
for (j in 0 until data[i].innerObjects.size) {
if (data[i].innerObjects[j].id == id) {
result = data[i].innerObjects[j].innerObjects
}
}
}
}
return result
}


By the way, the code is in Kotlin but feel free to suggest solution in Kotlin or Java.










share|improve this question

























  • You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

    – ruakh
    Nov 22 '18 at 1:45













  • @ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

    – Rainmaker
    Nov 22 '18 at 2:23
















0















The goal is to return the inner list of Object with a given param from the data list. The layer on which this Object will be found may vary.



The pseudo code for the Object is



class Object {
var id: Int
var innerObjects: ArrayList<Object>
}


If innerObjects param is null then we reached the leaf.



We are given ArrayList<Object> which is the data and id we are searching for. The Object we search can be on any level of the list.



What I have now is this piece of code but it only checks for 2 levels of the list. Please, suggest a solution that would work for any number of levels in the list. Possibly with recursion.



private fun getObject(data: ArrayList<Object>, id: Int): ArrayList<Object> {
var result = ArrayList<Object>()
for (i in 0 until data.size) {
if (data[i].id == id) {
result = data[i].innerObjects
} else {
for (j in 0 until data[i].innerObjects.size) {
if (data[i].innerObjects[j].id == id) {
result = data[i].innerObjects[j].innerObjects
}
}
}
}
return result
}


By the way, the code is in Kotlin but feel free to suggest solution in Kotlin or Java.










share|improve this question

























  • You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

    – ruakh
    Nov 22 '18 at 1:45













  • @ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

    – Rainmaker
    Nov 22 '18 at 2:23














0












0








0








The goal is to return the inner list of Object with a given param from the data list. The layer on which this Object will be found may vary.



The pseudo code for the Object is



class Object {
var id: Int
var innerObjects: ArrayList<Object>
}


If innerObjects param is null then we reached the leaf.



We are given ArrayList<Object> which is the data and id we are searching for. The Object we search can be on any level of the list.



What I have now is this piece of code but it only checks for 2 levels of the list. Please, suggest a solution that would work for any number of levels in the list. Possibly with recursion.



private fun getObject(data: ArrayList<Object>, id: Int): ArrayList<Object> {
var result = ArrayList<Object>()
for (i in 0 until data.size) {
if (data[i].id == id) {
result = data[i].innerObjects
} else {
for (j in 0 until data[i].innerObjects.size) {
if (data[i].innerObjects[j].id == id) {
result = data[i].innerObjects[j].innerObjects
}
}
}
}
return result
}


By the way, the code is in Kotlin but feel free to suggest solution in Kotlin or Java.










share|improve this question
















The goal is to return the inner list of Object with a given param from the data list. The layer on which this Object will be found may vary.



The pseudo code for the Object is



class Object {
var id: Int
var innerObjects: ArrayList<Object>
}


If innerObjects param is null then we reached the leaf.



We are given ArrayList<Object> which is the data and id we are searching for. The Object we search can be on any level of the list.



What I have now is this piece of code but it only checks for 2 levels of the list. Please, suggest a solution that would work for any number of levels in the list. Possibly with recursion.



private fun getObject(data: ArrayList<Object>, id: Int): ArrayList<Object> {
var result = ArrayList<Object>()
for (i in 0 until data.size) {
if (data[i].id == id) {
result = data[i].innerObjects
} else {
for (j in 0 until data[i].innerObjects.size) {
if (data[i].innerObjects[j].id == id) {
result = data[i].innerObjects[j].innerObjects
}
}
}
}
return result
}


By the way, the code is in Kotlin but feel free to suggest solution in Kotlin or Java.







java algorithm kotlin depth-first-search breadth-first-search






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 18:39









Jayson Minard

40.2k17112173




40.2k17112173










asked Nov 22 '18 at 1:29









RainmakerRainmaker

3,23131540




3,23131540













  • You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

    – ruakh
    Nov 22 '18 at 1:45













  • @ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

    – Rainmaker
    Nov 22 '18 at 2:23



















  • You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

    – ruakh
    Nov 22 '18 at 1:45













  • @ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

    – Rainmaker
    Nov 22 '18 at 2:23

















You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

– ruakh
Nov 22 '18 at 1:45







You need to use a graph traversal algorithm, such as depth-first search or breadth-first search.

– ruakh
Nov 22 '18 at 1:45















@ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

– Rainmaker
Nov 22 '18 at 2:23





@ruakh looked into those but the problem I faced that my return breaks the recursion. In the examples I found the algorithms don't return specific Node. Could you provide an example with the return?

– Rainmaker
Nov 22 '18 at 2:23












3 Answers
3






active

oldest

votes


















0














I have written java code for the solution :



ArrayList<TreeNode> solve(TreeNode treeNode, int id) {
if(treeNode == null) return null;
if(treeNode.id == id) return treeNode.nodes;
if(treeNode.nodes == null) return null;
ArrayList<TreeNode> ans = null, temp = null;
for(TreeNode t: treeNode.nodes) {
temp = solve(t, id);
if(temp != null) ans = temp;
}
return ans;
}


Demo on Ideone : https://ideone.com/cMmAqD






share|improve this answer
























  • Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

    – Rainmaker
    Nov 22 '18 at 16:28



















0














The solution I applied for my case in Kotlin for those who are interested!



private fun getObjectById(item: Object, id: Int): ArrayList<Object>? {
if (item.id == id) return item.innerObjects
for (child in item.innerObjects) {
val temp = getObjectById(child, id)
if (temp!!.isNotEmpty()) return temp
}
return ArrayList()
}

fun combineLists(data: ArrayList<Object>?, id: Int) {
for (j in 0 until data.size) {
getObjectById(data[j], id)?.let {
result.clear()
result.addAll(it)
}
}
}





share|improve this answer































    0














    So, in this case using basic recursion will solve this, but beware, because this kind of searching can quickly produce literal StackOverflowExceptions.



    fun getInnerObjectsById(nodes: ArrayList<Object>, id: Int) : ArrayList<Object>? {
    nodes.forEach{
    val ans = solve(it, id)
    if (ans != null) return ans
    }
    return null
    }

    fun getInnerObjectsById(obj: Object?, id: Int): ArrayList<Object>? {
    if (obj?.id == null || obj.innerObjects == null) return null
    if (obj.id == id) return obj.innerObjects
    return obj.innerObjects?.mapNotNull {
    solve(it, id)
    }?.firstOrNull()
    }


    This is a more involved, but imperative search.



    fun getInnerObjectsById(data: ArrayList<Object>, id: Int): ArrayList<Object>? {
    var activeList: List<Object> = data
    while (true) {
    val match = activeList.firstOrNull { it.id == id }
    if (match != null) return match.innerObjects
    activeList = activeList.flatMap { it.innerObjects ?: emptyList<Object>() }

    if (!activeList.isNotEmpty())
    return null
    }
    }





    share|improve this answer


























    • thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

      – Rainmaker
      Nov 22 '18 at 3:53











    • Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

      – gtcompscientist
      Nov 24 '18 at 19:23













    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422696%2fiterate-through-nested-list-to-return-inner-list-by-specified-param%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I have written java code for the solution :



    ArrayList<TreeNode> solve(TreeNode treeNode, int id) {
    if(treeNode == null) return null;
    if(treeNode.id == id) return treeNode.nodes;
    if(treeNode.nodes == null) return null;
    ArrayList<TreeNode> ans = null, temp = null;
    for(TreeNode t: treeNode.nodes) {
    temp = solve(t, id);
    if(temp != null) ans = temp;
    }
    return ans;
    }


    Demo on Ideone : https://ideone.com/cMmAqD






    share|improve this answer
























    • Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

      – Rainmaker
      Nov 22 '18 at 16:28
















    0














    I have written java code for the solution :



    ArrayList<TreeNode> solve(TreeNode treeNode, int id) {
    if(treeNode == null) return null;
    if(treeNode.id == id) return treeNode.nodes;
    if(treeNode.nodes == null) return null;
    ArrayList<TreeNode> ans = null, temp = null;
    for(TreeNode t: treeNode.nodes) {
    temp = solve(t, id);
    if(temp != null) ans = temp;
    }
    return ans;
    }


    Demo on Ideone : https://ideone.com/cMmAqD






    share|improve this answer
























    • Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

      – Rainmaker
      Nov 22 '18 at 16:28














    0












    0








    0







    I have written java code for the solution :



    ArrayList<TreeNode> solve(TreeNode treeNode, int id) {
    if(treeNode == null) return null;
    if(treeNode.id == id) return treeNode.nodes;
    if(treeNode.nodes == null) return null;
    ArrayList<TreeNode> ans = null, temp = null;
    for(TreeNode t: treeNode.nodes) {
    temp = solve(t, id);
    if(temp != null) ans = temp;
    }
    return ans;
    }


    Demo on Ideone : https://ideone.com/cMmAqD






    share|improve this answer













    I have written java code for the solution :



    ArrayList<TreeNode> solve(TreeNode treeNode, int id) {
    if(treeNode == null) return null;
    if(treeNode.id == id) return treeNode.nodes;
    if(treeNode.nodes == null) return null;
    ArrayList<TreeNode> ans = null, temp = null;
    for(TreeNode t: treeNode.nodes) {
    temp = solve(t, id);
    if(temp != null) ans = temp;
    }
    return ans;
    }


    Demo on Ideone : https://ideone.com/cMmAqD







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 '18 at 4:48









    uSeemSurpriseduSeemSurprised

    1,63521017




    1,63521017













    • Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

      – Rainmaker
      Nov 22 '18 at 16:28



















    • Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

      – Rainmaker
      Nov 22 '18 at 16:28

















    Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

    – Rainmaker
    Nov 22 '18 at 16:28





    Thanks, for the answer, it helped me to figure out how to apply it for my case, I will accept your answer and post my code also for future reference!

    – Rainmaker
    Nov 22 '18 at 16:28













    0














    The solution I applied for my case in Kotlin for those who are interested!



    private fun getObjectById(item: Object, id: Int): ArrayList<Object>? {
    if (item.id == id) return item.innerObjects
    for (child in item.innerObjects) {
    val temp = getObjectById(child, id)
    if (temp!!.isNotEmpty()) return temp
    }
    return ArrayList()
    }

    fun combineLists(data: ArrayList<Object>?, id: Int) {
    for (j in 0 until data.size) {
    getObjectById(data[j], id)?.let {
    result.clear()
    result.addAll(it)
    }
    }
    }





    share|improve this answer




























      0














      The solution I applied for my case in Kotlin for those who are interested!



      private fun getObjectById(item: Object, id: Int): ArrayList<Object>? {
      if (item.id == id) return item.innerObjects
      for (child in item.innerObjects) {
      val temp = getObjectById(child, id)
      if (temp!!.isNotEmpty()) return temp
      }
      return ArrayList()
      }

      fun combineLists(data: ArrayList<Object>?, id: Int) {
      for (j in 0 until data.size) {
      getObjectById(data[j], id)?.let {
      result.clear()
      result.addAll(it)
      }
      }
      }





      share|improve this answer


























        0












        0








        0







        The solution I applied for my case in Kotlin for those who are interested!



        private fun getObjectById(item: Object, id: Int): ArrayList<Object>? {
        if (item.id == id) return item.innerObjects
        for (child in item.innerObjects) {
        val temp = getObjectById(child, id)
        if (temp!!.isNotEmpty()) return temp
        }
        return ArrayList()
        }

        fun combineLists(data: ArrayList<Object>?, id: Int) {
        for (j in 0 until data.size) {
        getObjectById(data[j], id)?.let {
        result.clear()
        result.addAll(it)
        }
        }
        }





        share|improve this answer













        The solution I applied for my case in Kotlin for those who are interested!



        private fun getObjectById(item: Object, id: Int): ArrayList<Object>? {
        if (item.id == id) return item.innerObjects
        for (child in item.innerObjects) {
        val temp = getObjectById(child, id)
        if (temp!!.isNotEmpty()) return temp
        }
        return ArrayList()
        }

        fun combineLists(data: ArrayList<Object>?, id: Int) {
        for (j in 0 until data.size) {
        getObjectById(data[j], id)?.let {
        result.clear()
        result.addAll(it)
        }
        }
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 16:36









        RainmakerRainmaker

        3,23131540




        3,23131540























            0














            So, in this case using basic recursion will solve this, but beware, because this kind of searching can quickly produce literal StackOverflowExceptions.



            fun getInnerObjectsById(nodes: ArrayList<Object>, id: Int) : ArrayList<Object>? {
            nodes.forEach{
            val ans = solve(it, id)
            if (ans != null) return ans
            }
            return null
            }

            fun getInnerObjectsById(obj: Object?, id: Int): ArrayList<Object>? {
            if (obj?.id == null || obj.innerObjects == null) return null
            if (obj.id == id) return obj.innerObjects
            return obj.innerObjects?.mapNotNull {
            solve(it, id)
            }?.firstOrNull()
            }


            This is a more involved, but imperative search.



            fun getInnerObjectsById(data: ArrayList<Object>, id: Int): ArrayList<Object>? {
            var activeList: List<Object> = data
            while (true) {
            val match = activeList.firstOrNull { it.id == id }
            if (match != null) return match.innerObjects
            activeList = activeList.flatMap { it.innerObjects ?: emptyList<Object>() }

            if (!activeList.isNotEmpty())
            return null
            }
            }





            share|improve this answer


























            • thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

              – Rainmaker
              Nov 22 '18 at 3:53











            • Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

              – gtcompscientist
              Nov 24 '18 at 19:23


















            0














            So, in this case using basic recursion will solve this, but beware, because this kind of searching can quickly produce literal StackOverflowExceptions.



            fun getInnerObjectsById(nodes: ArrayList<Object>, id: Int) : ArrayList<Object>? {
            nodes.forEach{
            val ans = solve(it, id)
            if (ans != null) return ans
            }
            return null
            }

            fun getInnerObjectsById(obj: Object?, id: Int): ArrayList<Object>? {
            if (obj?.id == null || obj.innerObjects == null) return null
            if (obj.id == id) return obj.innerObjects
            return obj.innerObjects?.mapNotNull {
            solve(it, id)
            }?.firstOrNull()
            }


            This is a more involved, but imperative search.



            fun getInnerObjectsById(data: ArrayList<Object>, id: Int): ArrayList<Object>? {
            var activeList: List<Object> = data
            while (true) {
            val match = activeList.firstOrNull { it.id == id }
            if (match != null) return match.innerObjects
            activeList = activeList.flatMap { it.innerObjects ?: emptyList<Object>() }

            if (!activeList.isNotEmpty())
            return null
            }
            }





            share|improve this answer


























            • thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

              – Rainmaker
              Nov 22 '18 at 3:53











            • Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

              – gtcompscientist
              Nov 24 '18 at 19:23
















            0












            0








            0







            So, in this case using basic recursion will solve this, but beware, because this kind of searching can quickly produce literal StackOverflowExceptions.



            fun getInnerObjectsById(nodes: ArrayList<Object>, id: Int) : ArrayList<Object>? {
            nodes.forEach{
            val ans = solve(it, id)
            if (ans != null) return ans
            }
            return null
            }

            fun getInnerObjectsById(obj: Object?, id: Int): ArrayList<Object>? {
            if (obj?.id == null || obj.innerObjects == null) return null
            if (obj.id == id) return obj.innerObjects
            return obj.innerObjects?.mapNotNull {
            solve(it, id)
            }?.firstOrNull()
            }


            This is a more involved, but imperative search.



            fun getInnerObjectsById(data: ArrayList<Object>, id: Int): ArrayList<Object>? {
            var activeList: List<Object> = data
            while (true) {
            val match = activeList.firstOrNull { it.id == id }
            if (match != null) return match.innerObjects
            activeList = activeList.flatMap { it.innerObjects ?: emptyList<Object>() }

            if (!activeList.isNotEmpty())
            return null
            }
            }





            share|improve this answer















            So, in this case using basic recursion will solve this, but beware, because this kind of searching can quickly produce literal StackOverflowExceptions.



            fun getInnerObjectsById(nodes: ArrayList<Object>, id: Int) : ArrayList<Object>? {
            nodes.forEach{
            val ans = solve(it, id)
            if (ans != null) return ans
            }
            return null
            }

            fun getInnerObjectsById(obj: Object?, id: Int): ArrayList<Object>? {
            if (obj?.id == null || obj.innerObjects == null) return null
            if (obj.id == id) return obj.innerObjects
            return obj.innerObjects?.mapNotNull {
            solve(it, id)
            }?.firstOrNull()
            }


            This is a more involved, but imperative search.



            fun getInnerObjectsById(data: ArrayList<Object>, id: Int): ArrayList<Object>? {
            var activeList: List<Object> = data
            while (true) {
            val match = activeList.firstOrNull { it.id == id }
            if (match != null) return match.innerObjects
            activeList = activeList.flatMap { it.innerObjects ?: emptyList<Object>() }

            if (!activeList.isNotEmpty())
            return null
            }
            }






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 24 '18 at 19:22

























            answered Nov 22 '18 at 3:11









            gtcompscientistgtcompscientist

            613516




            613516













            • thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

              – Rainmaker
              Nov 22 '18 at 3:53











            • Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

              – gtcompscientist
              Nov 24 '18 at 19:23





















            • thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

              – Rainmaker
              Nov 22 '18 at 3:53











            • Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

              – gtcompscientist
              Nov 24 '18 at 19:23



















            thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

            – Rainmaker
            Nov 22 '18 at 3:53





            thanks for the answer, tried the first one but it doesn't find the Object by id. it only returns innerObjects of the last item in data no matter the id, and the second one doesn't compile as data is ArrayList and it doesn't have param id on line 4

            – Rainmaker
            Nov 22 '18 at 3:53













            Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

            – gtcompscientist
            Nov 24 '18 at 19:23







            Finally had a chance to address this with a compiler in front of me, and have corrected my solutions. I would highly suggest not using the recursive search. And also, you're final solution and the recursive solution in general, are using nested loops, which are also less desirable.

            – gtcompscientist
            Nov 24 '18 at 19:23




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422696%2fiterate-through-nested-list-to-return-inner-list-by-specified-param%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            'app-layout' is not a known element: how to share Component with different Modules