• Jesse Altman
  • NEWBIE
  • 25 Points
  • Member since 2014
  • Software Engineer
  • FinancialForce.com


Badges

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
hi,
I know you can do the following:
List<String> cnt = new List<String>();
for(Contact c : [Select Email From Contact]) {
         cnt.add(c.Email);
}

List<Contact> contactsWithValidEmail = [Select Email From Contact Where Email IN: cnt];

I was wondering if you could do the same for SET similar to below?
SET<String> cnt = new SET<String>();
for(Contact c : [Select Email From Contact]) {
         cnt.add(c.Email);
}

List<Contact> contactsWithValidEmail = [Select Email From Contact Where Email IN: cnt];
  • July 03, 2014
  • Like
  • 0
hi,
I know you can do the following:
List<String> cnt = new List<String>();
for(Contact c : [Select Email From Contact]) {
         cnt.add(c.Email);
}

List<Contact> contactsWithValidEmail = [Select Email From Contact Where Email IN: cnt];

I was wondering if you could do the same for SET similar to below?
SET<String> cnt = new SET<String>();
for(Contact c : [Select Email From Contact]) {
         cnt.add(c.Email);
}

List<Contact> contactsWithValidEmail = [Select Email From Contact Where Email IN: cnt];
  • July 03, 2014
  • Like
  • 0