Can I avoid nested for loop in this case? this code works fine but i want to know if this can be improved in any manner .

For every user I am fetching the namesList corresponding to that user and for each fetched nameList , i am fetching the ItemsList .

I have tried to replicate the sample using this below standalone program as i cant paste my project code as it got huge dependencies 

So i am hardcoding the users and the names List corresponding to that user .

package com;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String args[]) {
        List&lt;String&gt; users = new ArrayList&lt;String&gt;();
        users.add("user101");
        users.add("adminuser");

        for (String user : users) {
            try {
                ArrayList&lt;String&gt; namesCorrespondingtoUser = getNamesCorrespondingtoUser(user);
                for (String Id : namesCorrespondingtoUser) {

                    List&lt;String&gt; Items = getItemsCorrespondingtoId(user, Id);

                    filter(Items, user,Id);
                }
            } catch (Exception e) {
            }
        }
    }

    public static ArrayList&lt;String&gt; getNamesCorrespondingtoUser(String userName)
            throws Exception {
        ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();
        if (userName.equals("user101")) {
            names.add("UBSC1");
            names.add("HDBG1");
            names.add("GHYU1");
        }
        if (userName.equals("adminuser")) {
            names.add("UBSC1");
            names.add("HDBG1");
            names.add("GHYU1");
        }
        return names;

    }

    public static List&lt;String&gt; getItemsCorrespondingtoId(String userName,
            String Id) throws Exception {
            ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;();
        return items ;
    }

    private static void filter(List&lt;String&gt; Items, String user,String Id) {

// do something with the ID value of that User .

    }

}
I've seen, that you made up this code as an example, so I hope, that this is not your production code: 

public static ArrayList&lt;String&gt; getNamesCorrespondingtoUser(String userName)
        throws Exception {
    ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();
    if (userName.equals("user101")) {
        names.add("UBSC1");
        names.add("HDBG1");
        names.add("GHYU1");
    }
    if (userName.equals("adminuser")) {
        names.add("UBSC1");
        names.add("HDBG1");
        names.add("GHYU1");
    }
    return names;

}


If you take a look at both blocks, they are the same, aren't they?
But for further improvement, I would suggest working with a Map where you have usernames as the key and the according List of Names as the result.

Second: I would reccomend you to take a look at Google's Guava Library esp. the section about predicates .

Third: I am wondering, how you could retrieve any correct item. As far as I can see your names have to be unique to resolve the correct items. The collision rate for (nick-)names is generally high. So it would be better to switch to some ID-mechanism. 

Fourth: The task is in itself nested; you need to iterate over a list of items and over a list of users. So you couldn't "avoid" a nested loop. Okay: If you let a database do the magic, you didn't loop at all - the database does. But I think, that is not the answer you wanted.