Simple Apex Class to return list of string based on the length provided

Sample Code:

public class StringArrayTest {
    public static List<String> generateStringArray(Integer i) {
        List<String> listString = new List<String>();
        for(Integer j = 0; j < i ; j++) {
            listString.add('Test ' + j);
        return listString;


1 comment:

  1. Hi Sebastian,

    I executed "StringArrayTest.generateStringArray(6);" in the Anonymous Window but it didn't return a list of strings...
    I expected to see my listString returned in the "Debug Only" mode.

    Do you have any idea what the issue might be?




Sharing is Caring!!! Share this with your friends!!!

submit to reddit