Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to check whether an ArrayList is empty or not in Apex in Salesforce?

    Tagged: AccountNumber FROM Account]; if(records!=null && !records.isEmpty()) { for(Account record: records) { // Do Something Here } }

    • Salesforce® Discussions

      How to check whether an ArrayList is empty or not in Apex in Salesforce?

      Posted by Anjali on May 5, 2020 at 12:41 PM

      How to check whether an ArrayList is empty or not in Apex in Salesforce?

      Marziya replied 5 years, 7 months ago 4 Members · 3 Replies
      • AccountNumber FROM Account]; if(records!=null && !records.isEmpty()) { for(Account record: records) { // Do Something Here } }
    • 3 Replies
    • Kirandeep

      Member
      May 5, 2020 at 4:01 PM

      Another way to check if arraylist contains any element or not, we can check the size of arraylist. If the list size is greater than zero, then list is not empty. If list size is 0, list is empty. If we look inside the isEmpty() method, it also check the size of arraylist to determine if the list is empty or not

    • Ayush

      Member
      May 6, 2020 at 10:20 AM

      the isEmpty() method, it check the size of arraylist to determine if the list is empty or not

    • Marziya

      Member
      May 6, 2020 at 1:34 PM

      How to check whether an ArrayList is empty or not in Apex in Salesforce?

      • This reply was modified 5 years, 7 months ago by  Marziya.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    Salesforce Customization

    How to do Salesforce Customization Right?

    Blog in Salesforce customization

    When it comes to serving potential customers while balancing the sales of the business, Salesforce has unlocked countless opportunities for us to get involved. It…

    Appropriate Sandbox, Automate Workflow, Budget Constraints, Build Customized Team, Business
    Technosip Aug 6, 2021
    3,346  Views

    Top Salesforce Spring '22 Features (Part- 1)

    Blog in Salesforce Releases

    Salesforce's Spring '22 release notes are out and we cannot wait to show you what Salesforce has in store for all of us. We have…

    App, Auto-Layout, Business Goals, Business Objectives, Business Performance
    Apphienz Apr 20, 2022
    1,665  Views

    How Salesforce Consulting Services Transform Enterprise Digital Strategies

    Blog in Salesforce

    Enterprise digital strategies have shifted from simple technology upgrades to complete business transformation. Today, customer expectations, sales processes, and data-driven decision-making all require systems that…

    Salesforce App, Salesforce Consultant, salesforcedeveloper
    Raghav Nov 25, 2025
    109  Views

    Popular Salesforce Videos

    Apex Variables & Datatypes | Apex Basics | Salesforce Development Tutorials

    Apex Variables & Datatypes | Apex Basics | Salesforce Development Tutorials

    Video in Salesforce Development

    In this video variables, datatypes, literals and identifiers in Apex language have been explained in detail . This video contains only the primitive datatypes in…

    Salesforce Developer, Apex APIs, Salesforce Apex Class, Apex Data Types In Salesforce, Apex Variable In Salesforce
    Ashley Dec 14, 2018
    2,264  Views
    Salesforce Customer 360 for B2C Solutions

    Salesforce Customer 360 for B2C Solutions

    Video in Salesforce Stories

    Learn about Slalom's approach to creating integrated customer-focused experiences spanning B2C Commerce, Marketing Cloud, Service Cloud, Experience Cloud, and beyond. Watch this video by Salesforce…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Customer 360
    Prafull Jan 25, 2022
    3,904  Views
    See what amazing things Cauzali can add to your Salesforce solution - without code

    See what amazing things Cauzali can add to your Salesforce solution - without code

    Video in Salesforce Admin

    Use Cauzali to add functionality to your Salesforce community solution. In this video, we have a focus on Salesforce Financial Service Cloud, but Cauzali works…

    salesforce, Salesforce Video, Service Cloud, flow, decision making
    Tom Bo May 12, 2020
    1,921  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2025 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.