 Hello everyone, I am Sanjay Gupta, I welcome you on Sanjay Gupta Tech School. So today is our day 35 and we are learning Apex programming. So in this session, we are going to discuss about collection data type. And this is very important. So we have total three collections. So first we'll be discussing list data type today. So once again, hello and welcome everyone. So we will be just waiting for a few minutes so that more folks can join and then we'll be starting the sessions, session, sorry. So hi and welcome everyone. And I hope you are doing proper practice of Apex. That is important. If you do regular practice, then only you will be able to relate all the topics. So do as much practice as you can. Okay, so moving forward, so if you have started your Salesforce journey with this session only so you should know with whom you are interacting, who is your instructor. So this is about me. So just go through this slide so that you can have enough confidence in your instructor. And I hope everybody is focusing all the virtual learning best practices and I can see telegram group is fully like having all the interactions. People are asking questions, people are answering questions. So I hope that platform is helping you. So please keep practicing and don't miss any session. Even if you miss the live session, so recording is always available. So you can just go through and do the practice. So this is important, you know, consistency. So today I am delivering 35th session. So I'm consistent and I'm delivering sessions every week. So few folks are learning from the beginning few started from this week only. So please do regular practice so that you can become expert in Salesforce. So today also I will be like first explaining all the things and then we'll do Q&A. And if you have not joined this telegram group, so please join. I'm just sharing the link so that if you have not joined this till now, so you can join. So I just pasted the link in the chat so that you can join that link. So today we are going to complete week nine and from next week Monday we'll be doing more apex related stuff. So I hope I'm going slow. I'm covering every topic in detail so that you can just build your fundamentals properly and strongly. So if you have not followed any of the platform which are shown here, so just do follow because on these platforms I'm sending all the session reminders. So do follow and please share with others as well and help me to reach 100k subscribers. So it is a request in return like I'm delivering everything free of cost. So I just need your support so that the channel can grow and more and more folks can learn things freely. So today we are going to discuss about list. So list is basically a collection data type. So we have total three collection data types list set and map. So in today's session I will be covering all the aspect related to list. So first of all, we need to know what is list theoretically, right? And then we'll do proper hands on. So whenever you want to store more than one element of same type, then generally we create a list and list is basically ordered collection. So each element of list has an index for identification and index position of first element is always zero. Okay. List can be nested and even multi-dimensional. And if you want to create a list, so here you can see lots of data types are available. Like you can create list of primitive. You can create list of collections like lists of list or list of set or list of map. You can create list of s object that we discussed yesterday. And we have two types of apex classes. One is user defined and one is built in. So if you have apex classes that is built in or you created that. So for those apex classes also you can create list. Okay. So this is an example so that you can understand how it actually works. So for example, you want to store different colors in a single variable, right? So for that you can just create a list. So this is the syntax. You need to create list of string. Then here you can see colors is the name of that variable. Then through new VR initializing. And if you want to add values, so you will be using add method and inside single quotes like it is a string. So strings always we need to enclose in single quotes, right? So here you can see with this diagram, you can understand the indexing. So we stored four values into the into this colors variable. So here you can see four values are available, red, green, blue and yellow. And if we go to the bottom. So indexing is available. So index number zero is representing red. One is representing green, two is representing blue and three is representing yellow, right? So it is default. So we cannot control indexing. It is default. So at zero will be available always. Okay. And one more thing that you need to remember in this list, we can have duplicate values as well. Okay. So whatever list we are creating, so it can contain duplicates. So I'm jumping here and I'm going to demo this example. So I'm just going to use this anonymous window for demonstration. And for other implementations, I will be creating class as well. Okay. So here I'm going to create list of string, then name is colors, then new list of string. Okay. So this is the data type. So now list of string is a data type. So it means in this colors variable, you can store more than one values. So here I'm writing red. So colors dot add and then red. Then you can copy and paste it more than one time and you can change the values. Okay. So this way values are available. Now if you want to check whether these values are stored in this or not. So we can write colors list contains then plus colors. So this way, whatever values are available in this colors list, it will be available as an output through this system dot deeper. Okay. So I'm going to run this code. So I'm just clicking on execute and locks will be opening. They will find the debugs. So here you can see logs are opened and if we click on debug only, so you will see the result. So it is showing colors list contains red, green, blue and yellow. Okay. So this validates like this one variable is containing all the values together. Okay. So I just tested this code through this anonymous window. If you want to create a class, so we can do that as well so that whatever code we have written here, it will be saved permanently. Okay. Now you might be thinking how we can create different types of lists. So here are some examples. You can create list of string. You can create list of account. So account is basically s object that we discussed yesterday. We can use integer. And here you can see we are using SOQL. So little bit about SOQL I will be explaining in today's session not much because SOQL I will be covering in a separate session completely. So I will just give you brief demo about SOQL so that we can have some data that is available under account object. Okay. So before that, I just want to explain each and every method that is available with list. So basically the list which we are creating here, it is a class. So if you search on Google, so list in apex, right? So here you can see this is the first link which shows list is a class. So it is official Salesforce document, which is available publicly. So you can just go through with this list is a class. And here you can see list will be having few constructor and here we have all the methods. Okay. So if you want to see any method like like how it works, so you can just click and you will see the example. Okay. So this is important document. So I'm just sharing this document with you so that you can just go through with this document and along with my demonstration, you can do some practice through this document as well. So I'm just closing it. And I'm closing all these files so that I can create new file. And there I will be demoing you list. So I'm creating apex class, naming it as list demo. Here I'm creating a method public static void, naming it as list demo method, right? So here I'm going to create a list and will be demonstrating you everything. So I'm just reusing this code from here and I'm putting it here. Okay. So here you can see add is the first method that we already discussed. And here you can see we just need to pass the list element and that list element will be added into the list. So this way here we are using this add method and we are adding red, green, blue and yellow as a value into that list. Okay. Now if you want to add element at particular index, so that is also possible. So here I'm writing colors dot add one comma black. So I'm enclosing it in single quotes. Now here I'm just copying pasting it after this. So one more element will be added on one index. So right now on one index there is green. So now black will be on one index and green will shift to index number two. Okay. So I'm just saving this code moving here and from here I will be running this code. So copying the name of class. Then I'm going to copy name of method right and I'm going to run it. So clicking on execute. So locks will be opening and here you can see the result. So initially it is showing red, green, blue, yellow. Then we added black on one index or red, black, green, blue, yellow. So this way data is available. So I hope this way you are able to understand how we can add any element into the list at particular index, right? Then we have add all. So if you have created two lists and you want to add the data of one list into another so that can be done. So for that you need to create one more list. So here I'm going to create one more list. So naming it as color list two, right? So here I'm having these two. So here I'm adding white purple. So this is our second list, right? Now what I can do I'm writing colors dot add all and then here I'm passing colors list two. So what will happen, whatever values are available under colors list two, those values will be added into colors. So now I'm just copying it and pasting it here. So this time colors will be displaying total seven values. So I'm just saving it. And here I'm going to run it. So clicking on execute debug only. So here you can see the results. So first output is having four values. Second output is having five values because we added black at one index. Then we are having red, black, green, blue, yellow and two values we are having from that second list that we created. So this way if you want to merge two lists, so you can use add all, okay? If we see this method again, someone is asking Akula. So here what we are doing, we are just adding this black at index number one. So earlier index number one is occupied with green. Now green will shift to index number two and on index number one there will be black. So this we are doing with this add method, okay? So I hope you understood the explanation. Now I'm just skipping this method because it is adding set into list. So right now we don't know anything about set. So in next session when we'll be discussing about set, so I will be explaining this method. So I'm leaving it as is. Then we have clear method. So clear method basically removes all the values from the list. So here we have colors list two. So I'm just showing its values and then I'm writing colors list dot clear. And then again, I'm using this statement, okay? So here you can see what will happen. This message will be displayed colors list two will display two values. Then we are using clear. So the data will be erased. And again, if we display, so it will be displaying nothing. So I'm just saving this code and running this from anonymous window. So locks will be opened and if I click on debug only, so here you can see this line number 22 is showing white purple line number 24 is showing blank, okay? So I hope you understood this. And what I did, I just displayed this color colors list two. And I just use clear method so that I can clean the data. And if I use clear method, so data will be erased and this color colors list two will display nothing. It is blank. So I hope you understood. So right now I just used I just used add method to add values one by one into the list. Then if you want to add any value into list at particular index, so you can use this line number 13, then if you want to add a list into another list, so you can use add all. And if you want to clear values, so you can use clear method. Okay. So my view is asking, can we do colors list two dot add all colors? So yes, it is possible. You can add any list into any list. Okay. So that is possible. So I hope everybody is good till here. So as you are asking, please go slow. So I'm just explaining everything slow and still if you miss something, so I think recording will be available. So you can just clear doubts from there as well. So next is clone. So clone means if you want to create a copy of your list. So now what I'm going to do, I'm creating one more list here. List of string naming it as cloned list equals to new list of string, right? So right now this cloned list is blank. So what we can do, you can write cloned list equals to colors dot clone. And here I'm going to display it. So here I'm writing cloned list and here I'm displaying cloned list. Okay. So these three lines are important here to understand. So I just created new list, which is blank. I just cloned colors dot clone through clone method. So whatever data is available in this colors list that will go into this list colors. So the cloned list and that cloned list I am showing. So whatever is available in this colors list that will be available into this cloned list as well. Okay. And also remember one thing, wherever we are writing system dot debug. So just see the line number, line number 29. So in the debug log, like in the logs, wherever you will see the debug value. So you can just check the result through these line numbers as well. Okay. Asit is asking, can we add duplicate value? So I'm going to demo that as well. So right now I'm executing it so that I can show you the clone result. Okay. I think I didn't save. So you can see there is nothing as line number 29 because you can see this asterisk. I forgot to save the code. So I'm just saving it first. And now I'm executing it again so that we can see the result. So right now line number 29 is available and line number 29 you can compare with line number 21. Both are having same values. So this way we are able to clone the results. Okay. So there are two questions like I just need to show how we can add duplicate values. So I am doing that. So I'm copying it and pasting it above. So yellow, I'm trying to add multiple times into the colors list, right? I'm just trying to execute it. So you will see different results. So here you can see yellow is available twice. Then on one index we added black. So yellow shifted. Then we merged to list and then we cloned and this is like clear. So you can see duplicates are available, right? So I hope till now you understood everything. Now there is one question how we can return values. So I'm creating one method here public static, let's say list of string and naming it as return demo. So what I'm going to do, I'm just creating a list here colors and I'm going to return it return colors, okay? And here I'm going to create one more list, right? Now here I'm going to call it, okay? So what I did in this method, so just see the top lines, rest of the code is same. So what I just did, I just created one more method, okay? So we have two methods now. So our first method that is written above, this method is creating a list of string and it is returning that list of string, okay? And here we are creating one more list and we are calling this method return demo. So that method will be returning a list colors, the values will be available here. So I'm just pasting it here and here, okay? So this way we are calling a method which is returning list of string. Yesterday we saw how we can return ID. Today you are seeing how we can return list of string. So this way you can understand how we can return different, different type of values, right? So here we are calling this return demo and result will be available in this return values and this return values list will be displaying red, yellow and green. So I'm saving it and running it. So in debug only you can see a first line returned values list contains red, yellow and green. So these three values are available here and rest of the result is same. So this way I hope you understood how we can return a list of string from one method into another. So here we are not using void because we are returning. Here we are using void because this method is not returning any value. So VV Babu is asking when we are cloning. So you need to remember at this point of time, whatever values are available into this colors string colors list, all those values will be cloned. So initially it was having four or five values, then we added this list into this colors. So now colors is having a lot of values, right? So at this point of time, whatever values are available into colors variable, all those values will be cloned into this cloned list. Someone is asking, can AI replace Salesforce developers? So no, that won't be done. You can use AI as part of your help, right? So because we have Google, Google never replaced developers. You just need to learn how you can smartly use Google to search the related codes. So similarly, we will be using the AI. Yes, we can add values and curly bases as well. So I'm going to give you one more demo. So let me create it like this. So right now what we are doing, we are adding values like this. So I'm just commenting these statements. And I'm going to add values here inside curly bases. So what you can do, you can write values like this as well. So if you want to store values into this color list, so this way inside curly bases, you can write the values and it is similar to this ad. Okay. Yes, very quickly, you can use object as well, but that I didn't explain right now. So just take note of that. We will discuss this later on. So Antibrow is asking string list can clone integer value. So in my opinion, if you are merging cloning value, so you're both the list should be of same data type, right? Otherwise you will lost the values, right? So I hope till now everybody is good. Now I'm moving ahead. So we need to use next method, which is contains. So contains method basically search particular list element, whether it is available in the list or not. Okay. So now I'm moving here at the bottom. So here I'm just going to use this system dot debug colors. And here I'm writing colors dot contains and I'm going to search for red, whether red is available in the list or not, right? So it will be returning true or false. So I'm directly writing it here because right now we have not gone through with conditional statement. So I have not explained how to use if else conditional statement. So right now I'm using color sort contains red directly here. So if red is available in this colors list, so it will display true. Otherwise false. Okay. So it is available at line number 42. So I'm just going to run it clicking on execute selecting debug only. So line number 42 is showing true because red is available in that list. Okay. If I pass any other value, let's say I'm passing pink. So pink color is not available in the list. So this time if I execute, so you will see false in the result. So here you can see colors list contains equals to false. Right. So this way I hope you understood how we can use this contains method. Next we have equals. So if you want to compare values of two list. So just copy and paste it and colors dot equals. And here you can pass any other list. So I'm passing cloned list. Okay. So if both the list values are same, so it will return true. Otherwise false. So again, I'm executing this and here you will see the result. So in debug log, you can see colors list contains true because what I did, I just compared colors with cloned list and under cloned list, we are cloning colors. So both are same. If I use colors list two here, if I use colors list two here, so it will be displaying false. So I executed it again and here you can see debug is showing false because now both the list are having different values. Right. So this way I hope you understood how we can compare two lists together so that we can see whether they are having equal values or not. So a stick is asking, can we add key value pair in the list? No, that we will be doing with the help of map. So Nagarjun non static method. Generally we don't call in static method. So just forget about non static. We are preferring static method. So mostly we will be using static method. So don't get confused and you can call one static method into static directly. So that is not an issue. So if you are getting confusion on return statement, so no need to worry. We in lots of examples, we will be using return statement. So like when we'll be doing appropriate examples with the help of apex and trigger, then I think you will be understanding it more clearly. So in real time projects, we generally use static methods because we don't create instance of the classes because methods like you have implemented apex class. So that apex class method you will be calling into different file. So you won't be creating instance there. You will be directly calling the method. So static methods are used mostly. Okay. Now moving to next slide. So up and I saying little bit confusion. So what is the confusion? Can you just try? And iterator, I'm not explaining right now because we are not understanding loops. Okay. Prashant is asking pass method parameter and return. Yeah, that I can show. So before that I'm explaining this get method. So here you can see get method is saying we need to pass index and this get method basically gives you the value which is available at particular index. Okay. So how, how we can see that thing. So I'm going to show you that right now. So here I'm just copying this line and pasting it here. So here I'm going to use get method and instead of value, I'm going to pass index. So what I passed, I passed third index. So zero, one, two, three. So three index means it will be giving you the fourth value. Okay. So I'm just saving this code and I'm going to run it, clicking on execute. So I will take questions later on. I'm just going to explain each and every method first because it will, it is actually creating the confusion. So here you can see this color list contains green. So at third index, what is available green? So you need to see the latest values like this is latest one. So zero, we have red, one, we have black, two, we have yellow and three, we have green. So that's why it is showing green. Okay. Then we have index off. So for index off, we will be using values. So it is reverse off get like if you write index off. So here you need to pass the value. So here I'm passing green. So green is available at index number three. So now it will show the index of that value. So again, I'm running it. And in debug, you can see it is showing index number three. So green is available at index number three, right? So this way I hope you understood these two methods as well. So I'm repeating again, get returns value associated with particular index. So while using get, you need to pass index as a parameter and index off basically returns the index that is available at particular value. So green is a value and green is available at number three index. So this index off will be returning that index for you. Okay. So moving forward, we have is empty. So if you want to check whether your list is empty or not, okay. So you can just write system dot debug. So here I'm writing colors dot is empty, right? So this way you can check whether this list is empty or not. It is having values or not. So we are just executing it and we'll see the results. So here you can see empty is false. It means it is having the values. Okay. So this is empty method we will be using frequently. So whenever we apply a particular business logic and you are working on the list. So generally we apply this is empty method so that if list is having something, then only we process that list. If list is having nothing, then we don't process the list, right? So this way you can test it and we cleared values from colors list two. So if I use it, so it will be returning true because it is empty. So I can just show you that as well. So I'm just copying colors list two and pasting it here, saving it and I'm going to run it, okay? So it is saved now. So now I'm just clicking on execute. So here you can see empty is equals to true. So colors list two is basically blank. So that's why it is showing true. So this way if you want to check whether your list is containing some data or not you can just check. And remember you also have to do practice in the same way. Don't just watch the recording or live session and do this practice yourself then only you will be able to understand. So in our exercise sheet, I just mentioned everything here. You need to practice each and every method that is available inside list class the way I'm explaining it to you so that you can also understand the things. Then we have remove method. So remove is basically to remove a value that is associated at particular index. So here I'm writing colors.remove and I'm writing three. Then I just want to see the results. So if I paste it here, so at index number three we already know we have green as a value. So now through this line number 49 colors will be displaying the values without green. Okay, so only the value which is available at number three index will be removed from the list. So I'm just going to run it so that we can see the results. So here you can see green is not available in this list. So earlier it was available everywhere but now it is not available. It is removed from the list. And after this line, wherever you will be using this colors list green won't be available. Okay, so changes will affect after this line only. Before this line, green will be available but after this line colors list won't be having green value. Okay, so someone is asking can we count? So here is the method size we can and this set method is similar to the add method. So the way we used add method to add element into the list at particular index, similarly you can use the set method. So you have both the option either use add or set. Then we have size, if you want to see the size. So what we can do, I'm just copying these two methods or these two statements actually. And here I'm writing size, size, right? So this way you can use size method so that you can count how many elements are available and just run it so that you can see the results. So here you can see in this colors list colors size is seven and other colors list two is zero because it is having nothing. Okay, so this way you can just check the size as well. And last is sort. So sort basically will be displaying values in particular order alphabetically. So here you can write sort. Okay, so here it is giving an error. So arithmetic operation is not allowed. Okay, let me check the syntax of this method. So here we have sort. So, okay, so what we need to do, I'm just cutting it from here, writing it here. And then here I'm writing just colors. Let's see whether it works or not. Yes, now this way it will work. So separately you need to write sort. First it will be sorted and then you can display it. Okay, so anytime if you get stuck with any method you can just go to the document and you can take help. So I'm just clicking on execute and here logs are available debug only. So you can see the values are sorted. B, then B, P, R, W, Y, Y. So this way you can see values are arranged alphabetically. Right, so this way I try to explain each and every method and now I'm going to move to next part where I'm going to explain you how we can use list with S object. Right. Before that I just want to show you one more thing. Like someone was asking can we pass values to method as well? So from here I'm passing one value, let's say black and here I'm going to receive it as tier one. So let me pass two values, black and purple. So I'm receiving it like this. Okay, so from this method call return demo I just passed two values, black and purple. So black will go to S tier one and purple will go to S tier two. Now what I can do, I can write colors dot add S tier one. Then I can write colors dot add S tier two. So this way these three values will be initialized and after that these two values S tier one and S tier two will also be added and then this can be returned. So this way you can pass values and you can return as well. Okay, and don't worry about this like how to pass values and return. So later on when we'll be discussing real time examples like right now we are just getting familiar with the concepts later stays when we'll be implementing triggers. So actually we will be implementing real time scenarios then you will be understanding more. Okay, so right now your primary focus would be to understand different methods those are provided by list class so that you can understand the working of those. Okay, now I'm going to explain this example how to insert two account records using list. So yesterday we discussed how we can insert one account record. Now if you want to insert more than one account record so you can just create a list and you can add those record into that list and you can insert them. Okay, so here above I'm just creating a method. Okay, so method name is s object list demo. So here I'm going to create list of account. Okay, prior to that I'm going to show you how we can create two separate accounts and what should be the issue if we create two separate accounts. So I'm creating account ACC. So it will be ACC one then new account. Here I'm initializing it with name and active is true, sorry, required field. So I'm populating that as well. Then we can write insert ACC one then account ACC two equals to new account. So this I'm like having values like this ACC two dot name so that you can just have two different ways. Even we discussed it yesterday but I'm just explaining it again. So we have two different ways to pass the values into different fields. You can use anyone, right? So first way says in the same line you can just initialize the field values and second way says like in separate lines you can put the values and we have to insert statement. So I told you insert is a DML statement which inserts record. Now if I run this method so we have two insert statement, right? So let's see what happens. I'm just stealing the code, copying this method name, pasting it here. So two records will be inserted and we want to open the log. So I will show you the logs. Now here you don't need to click on debug only. Just crawl it at the bottom. So here you can see how many number of DML statement executed to because we used insert statement twice, right? And the limit is 150. So for example, if you want to insert 200 records and if you write insert statement 200 times so at 151 point your code will break because the limit is 150. In a single transaction if you write more than 150 insert or other DML statements so your code will break. So you need to try to reduce number of DML statements. So the best way is to use the list. Okay. And here you can see number of DML rows is two out of 10,000. So at one go we can insert 10,000 records. So two rows we inserted and two DML statement we used. Now I will show you how you can reduce DML statement count to one. Okay. So what we can do, we can create a list here, right? And instead of writing insert you can write ACC list dot add ACC one. So we are using add method to add this account into this ACC list. Okay. Now here also you can write ACC list dot add ACC two. So this account is also added. Now you can write insert ACC list. And before that, like yeah. So before that you already added both the account records into the list. So this list will be inserting two accounts but it is using one DML statement. So total one DML statement will be counted and it will be inserting both the account records. So very goody, it is not for class coverage, code coverage, it is governor limit. Like in one transaction you can have some limited amount of DML statements. Okay. So it is saying duplicate record found. Okay. So we have duplicate rule. So I'm just changing this name. So for account name, I think we have duplicate rule. So now it will execute. And if we scroll down, so see here, number of DML statement is one out of 150. And DML rows is two because we are inserting two records but number of DML is one, right? So this way you can reduce number of DML statement with the help of list. So I hope now you are able to understand the actual use of list with S object. And you also got to know how we can insert more than one records into the database, right? Now, if you ask me, can we insert N number of records? So my answer will be yes. But right now I cannot explain because we don't know how to implement loop in Apex. So we will be first understanding loop in Apex. And then I will let you know how we can insert more than one record, like N number of records through loops into the org, right? So this way I think you will be able to understand how we can insert two position records, okay? So quickly I am going to show you that thing. So I'm just copying it, pasting it so that I can create another method. So this is for account now S object list for position, right? Now here we need to change the object position underscore underscore C. Then here you can write position list. So naming convention you need to follow that I already discussed. So here two words are available. So first word will be small and second word. First letter should be capital, right? Then here again position then here we can write POS, new position then position name, let's say DAV, rest I'm leaving blank. Then here it should be POS list then POS one, right? I'm just copying and pasting it here as well. So just changing it to POS two name is QA and it is POS two and both the positions are added into POS list. So I'm just going to insert it. So this way you can use custom S object with list. So very goody you cannot cross 150 DML limit. It is fixed. So you need to write your code in such a way so that a number of DML rows is two, right? So this way I hope you understood how we are using it. Now one more example I'm going to show you. So here what we are trying to do if you get data, existing data that is available in your org. So for that we use SOQL. So I'm briefly explaining SOQL, right? And we will be having separate session on SOQL. So no need to worry. So it is S for Salesforce, O for object, Q for query, L for language, Salesforce object query language. So we can fetch existing data and whenever we write SOQL, the returned value will be available into this list. How we can do that? So I'm going to show it through anonymous window only. So I'm creating list of account, ACC list equals two. Then here I am writing select ID, name from account, and here I'm writing limit five. So this way this is basically SOQL. So I'm not going to explain it in depth because we will be having separate session. So I just want to show you how we can fetch the existing data. So I'm showing it like this way. Okay, so whatever existing data we are getting, so five records limit is five. So five records ID and name will be fetched. They will be available into ACC list and we are displaying it. So I'm going to run execute highlighted. Now clicking on debug only, so here you can see the result. See it carefully. So we have account list. So this is first account ID and name. This is second account ID and name. This is third account. Then fourth account and then fifth. And you will be getting five random account, okay? So whenever you query something that is available already with the object. So existing data you can get through SOQL. So similarly you can query position records as well. Here we have where clause also, where status equals to new position. So how you can write list of position underscore underscore C position list equals to select ID name from position underscore underscore C where, so we need to check the position object for field API. So I just want status field API. So it is there. I'm just copying and using it here. Status equals to new position, right? And here I'm writing system.debug position list equals to and here I'm writing position list. So whatever data we are going to query that will be available into this POS list and that will be displayed. So clicking on execute highlighted and let's see the result and debug only. So here we have ID and name. So all those positions we are getting wherever position is open position like new position, okay? Okay. So no need to worry if you didn't understand SOQL we will be having separate session for that. Just remember whenever we query the data so that query data will be stored into list only, right? So whenever we apply any SOQL the return data will be stored into the list always. Okay, so this is all about that I planned for today's session. So now if you have any question you can ask. So I'm just going back so that I can answer a few questions. Okay, very quickly you are asking iterator in the list. So let me just check whether it is available. Yeah, so returns an instance of an iterator for this list. So basically it is for checking whether you have next or next element or not. So here you can see this example is available. So you can just go through with this. So here we are using iterator account. And then we are putting these values list of account and integer. Then we are implementing a constructor. So this is constructor basically. So this is a constructor. Then iterator is having these two methods has next and next, right? So if you want to check whether next value is available or not, you can apply this. And if you want to have the next value, so you can use this next method. So just implement this and this way you will be able to test it out. Okay, and generally we won't be preferring this iterator method. Instead, we will be using for each loop that I will be explaining later on. So Dharini is asking what is best advantage of static methods. So if you create static method, you don't need to create instances. So that is the benefit. We can directly call them. And at many places, we need to call the methods directly without creating instance. Yes, I will be doing integration sessions. So first we'll be understanding all the Apex related stuff and then integration sessions will be there. So Puja, I think remove, we cannot remove multiple elements together. So yes, first, in this list, index always starts from zero in Apex as well. Yes, Jhana, if you sort, so indexing will be changed. Yes, Rhetora's lists are same like arrays, but we have different methods. So in programming array is not a class, but here list is a class. No, Siva, we cannot add two values like this, ACC one comma ACC two. This is incorrect. Add can have only one parameter. So very quickly list constructor are very easy. So one I explained. So in this example, if you see, I just explained you this way. So this basically we are utilizing constructor functionality. So because Chandra, if you're not able to catch, you need to do more practice and then only you will be able to understand. Yes, Rebati, we can use constructor in list. Thank you, Asit, thank you, Sashi. Yes, Manjun, we can add specific element from one list to another, but we don't have any specific method for that. No Jyoti, if element is removed, we cannot add that again. Thank you, Vikash. So if you want to understand it in detail, like just go through with this document here, a few more things are available that you can go through and understand. Okay, so Manan, this is the only reason like we don't need to create instance and we can call that method directly. So this is the most preferred reason we are creating static methods. If you want to create instance, then you can convert your method into static, sorry, non-static. Okay guys, so very quickly, this is basically a template like if you want to copy one list into another and you don't know the type, then you can just use it. So examples are there in the document, just try that out. Okay, so Nikhil, you can become good in coding by practice only, so do as much practice as you can. So through practice only, you will be able to become expert. So I'm explaining everything in detail so that you can understand things very easily. So just do practice more and more. Okay guys, so thank you everybody. See you on Monday. Next session will be on Monday. So this week, Friday, I don't have any session. So see you on Monday and we'll send you the reminders. Thank you everyone.