This may be error prone, as I haven't tested it, but it should work. Even if it doesn't, it should be extremely close to what you are looking for. Note that the first for loops populate the resultList instead of setting values, as there will be nothing to append to.
Let me know if there is an issue and I will correct it.
ArrayList results = new ArrayList();
ArrayList components = new ArrayList(){"a","b","c"};
int n = 4;
int size = components.size();
for ( int j = 0; j < size; j++ )
{
// start with size^(n-1) copies of each letter.
for ( int i = 0; i < Math.pow( size, n-1); i++ )
{
results.add( components.get( j ) );
}
}
// At this point you have each letter in there once...
for( int depth = 1; depth < n; depth++ )
{
for( int j = 0; j < size; j++ )
{
String toAppend = components.get( j );
for( int i = j; i < results.size(); i += size )
{
String current = results.get( i );
current += toAppend;
results.set( i, current );
}
}
}