[SalesforceDeveloperCertification]認定 Platform デベロッパー資格の更新 (Winter ’25)

public class MyIterable implements Iterable<String> {
    private List<String> strings {get; set;}

    public MyIterable(List<String> strings) {
        this.strings = strings;
    }

    public Iterator<String> iterator() {
       return this.strings.iterator();
    }
}

@IsTest
private class MyIterableTest {
    
    @IsTest static void testIterableForLoop() {
        
            List<String> strings = new List<String>{'Hello','World'};
                
            MyIterable mi = new MyIterable(strings);

            Test.startTest();
            
            for (String str : mi) {
                System.debug(str);
            }

            Test.stopTest();
    }
}

投稿者: kinkun

保有資格 Salesforce Certified Platform App Builder T Salesforce Certified Platform Developer I Salesforce Certified Platform Developer II Salesforce Certified Administrator

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です