DataType in apex and list collection

Salesforce Development Using Apex DataType in apex and list collection
1 hour 10 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€48.10
List Price:  €67.35
You save:  €19.24
£39.88
List Price:  £55.83
You save:  £15.95
CA$71.97
List Price:  CA$100.76
You save:  CA$28.79
A$80.16
List Price:  A$112.23
You save:  A$32.07
S$67.96
List Price:  S$95.14
You save:  S$27.18
HK$388.27
List Price:  HK$543.62
You save:  HK$155.34
CHF 45.02
List Price:  CHF 63.04
You save:  CHF 18.01
NOK kr569.59
List Price:  NOK kr797.48
You save:  NOK kr227.88
DKK kr358.90
List Price:  DKK kr502.49
You save:  DKK kr143.58
NZ$88.63
List Price:  NZ$124.10
You save:  NZ$35.46
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.45
৳5,972.19
List Price:  ৳8,361.55
You save:  ৳2,389.35
₹4,258.89
List Price:  ₹5,962.79
You save:  ₹1,703.89
RM224.30
List Price:  RM314.04
You save:  RM89.74
₦77,378.02
List Price:  ₦108,335.42
You save:  ₦30,957.40
₨13,924.71
List Price:  ₨19,495.71
You save:  ₨5,570.99
฿1,707.62
List Price:  ฿2,390.81
You save:  ฿683.18
₺1,762.36
List Price:  ₺2,467.44
You save:  ₺705.08
B$310.08
List Price:  B$434.14
You save:  B$124.06
R926.14
List Price:  R1,296.68
You save:  R370.53
Лв94.05
List Price:  Лв131.68
You save:  Лв37.62
₩72,995.06
List Price:  ₩102,198.93
You save:  ₩29,203.86
₪183.24
List Price:  ₪256.56
You save:  ₪73.31
₱2,921.84
List Price:  ₱4,090.81
You save:  ₱1,168.96
¥7,853.11
List Price:  ¥10,994.99
You save:  ¥3,141.87
MX$1,006.35
List Price:  MX$1,408.98
You save:  MX$402.62
QR182.19
List Price:  QR255.09
You save:  QR72.89
P691.26
List Price:  P967.82
You save:  P276.56
KSh6,461.20
List Price:  KSh9,046.20
You save:  KSh2,585
E£2,544.49
List Price:  E£3,562.49
You save:  E£1,018
ብር6,361.91
List Price:  ብር8,907.19
You save:  ብር2,545.27
Kz45,590.88
List Price:  Kz63,830.88
You save:  Kz18,240
CLP$49,514.09
List Price:  CLP$69,323.69
You save:  CLP$19,809.60
CN¥364.84
List Price:  CN¥510.80
You save:  CN¥145.96
RD$3,032.23
List Price:  RD$4,245.36
You save:  RD$1,213.13
DA6,760.37
List Price:  DA9,465.07
You save:  DA2,704.69
FJ$115.98
List Price:  FJ$162.39
You save:  FJ$46.40
Q385.05
List Price:  Q539.11
You save:  Q154.05
GY$10,455.66
List Price:  GY$14,638.77
You save:  GY$4,183.10
ISK kr6,980.10
List Price:  ISK kr9,772.70
You save:  ISK kr2,792.60
DH502.81
List Price:  DH703.98
You save:  DH201.16
L922.32
List Price:  L1,291.33
You save:  L369
ден2,959.81
List Price:  ден4,143.97
You save:  ден1,184.16
MOP$399.96
List Price:  MOP$559.97
You save:  MOP$160.01
N$920.98
List Price:  N$1,289.45
You save:  N$368.46
C$1,839.04
List Price:  C$2,574.80
You save:  C$735.76
रु6,810.12
List Price:  रु9,534.71
You save:  रु2,724.59
S/186.41
List Price:  S/260.99
You save:  S/74.57
K202.74
List Price:  K283.85
You save:  K81.11
SAR187.78
List Price:  SAR262.91
You save:  SAR75.12
ZK1,383.10
List Price:  ZK1,936.45
You save:  ZK553.35
L239.36
List Price:  L335.12
You save:  L95.76
Kč1,209.95
List Price:  Kč1,694.03
You save:  Kč484.08
Ft19,835.61
List Price:  Ft27,771.44
You save:  Ft7,935.83
SEK kr553.09
List Price:  SEK kr774.38
You save:  SEK kr221.28
ARS$51,277.48
List Price:  ARS$71,792.58
You save:  ARS$20,515.09
Bs346.08
List Price:  Bs484.55
You save:  Bs138.46
COP$219,391.32
List Price:  COP$307,165.41
You save:  COP$87,774.08
₡25,377.51
List Price:  ₡35,530.54
You save:  ₡10,153.03
L1,269.45
List Price:  L1,777.33
You save:  L507.88
₲390,156.27
List Price:  ₲546,250
You save:  ₲156,093.73
$U2,225.52
List Price:  $U3,115.91
You save:  $U890.38
zł205.57
List Price:  zł287.82
You save:  zł82.24
Already have an account? Log In

Transcript

This conference will now be recorded. Okay in the previous session, we have discussed what is optics, okay. And the architecture of optics and that demon deposition link also I have shared with you. Okay, so today we'll see how we are going to write the bricks and whatever tools were using. Okay, nothing but today we're going to learn a new language completely, which we call epics. We'll learn 40 these epics, and how we can write epics program in Salesforce, okay, so see, if you see your past experience, you have won many languages maybe, or maybe you are completely new.

You may learn C c++ or maybe Java or some language. Forget this technical language. If you see the language when you learn a new language, maybe you'd learn French or maybe you want to learn English, or when you learn your mother tongue for nothing but same we will Learn this new language. So, it may be technical non technical, to learn any language, as we shall learn what is that language and how you can make a sentence. So he picked up when I learned English when not him, but we pointed out that day one we didn't start to speak in English. Okay?

So to complete the sentence like if I'm a good boy, I need this sentence if I can speak the sentence that means I know English language, right? So to make the sentence, I need few words, like maybe this good or boy part of the word we need p words. So patchouli should know how to make this words nothing but I can say before we learn these first we learn, okay, how to clear the words. Okay? Like maybe a good, maybe a boy. We learn that kind of thing.

And once we know this one, that means what when I'm making the word something, but we put that out Learn how to write the alphabets. So same way we are going to learn the suffix. Okay, so before learning the artists learning people are going to write a completely complete app based program. So we should know a lot of syntax. Okay, so how that syntax will build to make a complete sentence. And with that complete second sentence, we will make a method or plus a theme body I know this sentence I'm a good boy.

Like that I can combine minute and tense to make a paragraph. And many paragraphs can make one chapter or many chapter can make one move. So same way I'm going to do what we learn fast we learn first party alphabet. Then we learn how to make the word from the alphabet. Then we learn from the word how to build the sentence. Upon that sentence, we learn how to make one paragraph from the parent up then we got to know how to make Make a chapter that chapter of the board will learn how to make a complex book.

Correct. If you seen technically possible log will learn all the syntax and the syntax. Okay? We'll make declare the sum of some variable or something, okay? Nothing but once you build the syntax, so slowly commenting on syntax, we can build a sentence on complete sentence, all the combination of sentence, okay to make the sentence syntax, we need some problematical languages, okay? And once you make the sentence limbered from the complete sentence, we can make a method or we can make a class Okay, from the class, we can make a small project.

So in that way we go. So Patrick need to know what are the syntax I will here and how I can do it. Okay, as I said, epics is nothing but it's completely object oriented programming language First of all, so epics is nothing but a strongly Type object oriented programming language when I said object oriented programming language what it means nothing but the language which supports inheritance polymorphism abstraction all these things we call that object oriented language everything we are going to represent as object let me show you here. So, to learn the topics what I need to do so, past I need to learn how to declare variables so, understanding all these basic concepts how to declare the variables okay what are type of variables we can declare okay and using their variables and what kind of logic we can write okay and what are the variables available for us in the system.

So, passing people learning objects will learn what is data types and variables. Okay, so, understanding on a basic level local reading, you may be In some knowledge of programming you may have or you may not have a destructible for all these things, and starting from the basic level, if you feel you will know these things, then we can keep also. Okay. So first we're going to learn what is datatype and variable instances. Okay? So now, when I'm going to write it, this class, or maybe one line of code, where I will write in such rules, let me go to here in the Salesforce if you come here, so as I said, we have something called Developer Console.

Nothing but which we call an anonymous window. Okay, I can write any piece of code. And I know I'm not going to save this piece of code anywhere in the server. He will remember the past dozen years whenever I'm writing something, and I click on the save what happened. So that piece of code goes to my Mater the test server, okay, but right now Code what I'm going to write here, I am not going to save it. So without giving any name with this erroneous code, I can include something if you want to put in the anonymous code we can do from this anonymous window, or from this Developer Console, you can go to File, you can create any new class, and we have something called trigger page.

And also you can open an existing theme. So right now we're not focusing on this part. Okay. I will write everything in dominoes from dinette. So you the same way, even we have inline editor here, okay. If I want to write in a new class, I can come here.

I can use this app is class. I can fight I can click New, same way. I can use any third party tools. So maybe these are 30 or maybe a Cleves sublime, or anything you can use. Okay. You're also I can use this editor of your ID, too, to write my quotes.

Okay, it is your job. So I just shown you the different places where I can write the piece of code, but to write that piece of polish to learn it, so pass they're going to learn what is duct tape and variable. Financing very relevant variable. If you remember, anytime you have cleared a field so are you know, the selfoss admin stuff? You have created? fields in objects that are in nuclear detail, what do we do first, we define what type of data it's going to say maybe text picklist checkbox currency any day.

So pass will define the field type nothing about which we call data. Okay. in Salesforce, we have different types of data provided, okay, some directives already provided by Salesforce and even we can create our own database. We will see all these artists whatever we have, we have right now. Okay. So now so let's see.

I want to say I want to store roll number of a student your financing roll number maybe roll no in this format something like that okay that time it looks like some number and printer saying I want to store student name. So that thing it may be like this is looking at nothing but looks like a text okay. Whenever I want to say okay, I says is working or not it may be and so comes with yes or no. So this kind of data we have. So to store this 123456 number 13 what aquariums let EPA say okay, I declare one variable, which I said roll number equal to 123456. So what is this roll number and in memory where I'm storing.

So by name saying a program, nothing but something is being stored in memory, memory in the sense mind. program memory it may be heap memory of stack memory. If in that case if you see, let me clear these. Okay, up clear this. So, we have something called heap memory. If I go to eat memory, the moment I said I want to store one data, nothing but one.

So Samia in the memory I want to store let's see, I kept this memory cluttered. And here I just told us this woman should assist so now this is my memory but whenever I am writing some program, let's see here I have something where I'm writing the programs. Okay, here's something I have very regular programs, okay. Now, how I will refer this one, how are they for this memory? Okay, so from this program to refer this memory recursion, I have to give some name festival Word consider I give a name as name. Okay, I certainly am.

So when I say a name, so this name is going to show what they do if you see, okay sir name is a variable lawyers told us is what? What is his name? Okay? So the name variable what name I gave for this memory location? Okay. Let's see the name his name.

Okay, so what type of data came to okay so let's do Ross's so he's somebody may come can store okay 50% so it's not a very data. So what kind of data to be stored here that we represent aka direct AI. So whenever we declare a variable What do we do? This is a syntax for us, okay, Doctor dive, my name variable name Okay, my variable name and this is optional. Optionally I can assign some initial value also Okay, deny every statement and sudo semicolon. So now, if I want to store in, so I know nothing what looks like a string, okay, string to their name.

Okay, equal to, let's see, I will because I see So I see your text right capabilities. If you see this line, it is nothing but one statement in my program. Okay, this statement what statement This is a statement of assigning a value to a variable. So whenever you declare a variable, we have to specify data and variable name the same way, Salesforce has provided different type of data to us, okay. So we call something called primitive types. I think I type it something called primitive pace, okay.

And we have something called a subject through each line by line and something we have called collection pipe. Okay. So now these are different types of data itself was given, okay? So whenever I'm saying primitive types four types out there. So primitives concrete, like you have whatever integer string same way different types of data we have, we start with blob. Okay whenever you have a large object data to store that time you can use blob type of data.

Do not think about your emails, or maybe a big text you want to store that takes a binary large object file when you want to store that name. You can use blob type symbol if you want to use true or false value that that 10 can use Boolean. Okay, same way you can do dead Okay, dead time Like there are many data so we are just listing out everything slowly when you write programs you will get a symbol or a double. So we have integer Okay, so we have long we have object is one type I'll explain what is object type. So, in the Salesforce whenever you see object like a position or candidate maybe account maybe contact opportunity each are represented as object object nothing but the master type of all objects, okay, it may be account object but it does represent as an object okay.

So say my lemonade string and the date the time also we have a timetable data. These other primitive types are provided with Salesforce, okay, when they come to us, hopefully nothing but any object in Salesforce represent are they subject which we can call it may be account maybe contact or maybe any custom object all custom objects and with custom object name okay object name underscore underscore c okay. So all these objects are nothing but can be represented as a subject okay. And when I say collection type these are nothing but three type of collection provided by Salesforce which we call least set and map okay. So these are different types are given by the Salesforce and we will see each one how we're going to do okay till now any confusion. Now as is the perfect Okay, so now see if you like any problem or any moment, so you have to store some data to process the logic.

There. See, I will say okay, get me a list of our contractors inquire account rating is hot and after getting that record process exchange logic when you get that record you go to store Sameer your store in some variable okay that variable nothing but declare we have to define the type of that. So whenever you need that has to define what type of data you want to store then that then variable name and the see if you want to store string data type name string variable name and this one. Okay. So a subject I will tell you in the end of this depresses so let's see what is this collection type? Okay?

As I said I want to store names. Okay. So I mentioned string student name it will do. Let's see, Ashish. Okay. Anyway, I want to start another session.

Him, so I made it as string surname one. Okay. So I met under variable length string, student m two equals Oh, let's see three. So like this, I have 50 students. So is this looks good if I create 50 variables separately, like this 3456 independence, it not sounds cool. So, every variable consumes some memory in main memory.

So for each variable if you go, it will create one small memory space for me like this. If I gave you 30 more dispersers on hold. Okay, so what we do here instead of this approach, if you see this RCS three, okay then some other name and just typing here. Okay, this is my mother's maiden name. So you fix it. Okay, this is me another short name.

So if you see all these names, these different students, okay? But if you see the same type of data, I'm going to store it there's nothing about Can I say this highlighted text nothing but collection of the students collection of names. Okay. So whenever you have this kind of collections to store, instead of storing in each individually, we use list or map or set nothing but if you know any other language, you will you have heard about our array, okay, same kind of thing I'm doing here. Okay. So he instead of array I'm diagnosing list or set or a map, these all are different type of collection in Salesforce, okay, we'll see what we can do on this.

Okay, any collection type of data you collision the collision data you want to store you can measure like the example I have told here, if this is your collection of names, instead of touring in multiple variables, I can store in one variables Okay, so what is that any collision variable? Now depends. It's at least a person or set or map or a word. Okay? So we've got to go any lease at map let me store this Melissa Allison. And I also put it that and how we do okay.

So now if you declare this variable like these in memory, it created like this number like this, which included memory space, but if you're storing collection, what will happen in the collection if you show if you see it recreate exactly one memory for us. Okay. So instead of each individually, it will create only one memory. Let's see the name of this memory, we gave us student name. student name list. Okay.

So now on each part, okay, so we do for each name, one block will gender okay. So all the students can be deferred only with one name, and we can assess them individually. Okay. So this Nothing but at least type of policing so financing lease stereo collision we'll see in Salesforce how we can defend this lease position and what we can do with this collision instance was any confusion no no okay. Now I'm going to do what is least in Salesforce and how we are going to use a financing list it is nothing but it's a type of collection instances Okay, what type of collection it will see. So it keeps same type of data nothing but I can say homogeneous type of data.

Okay, the receive stream is also the string I cannot keep okay with this string, I cannot keep one caller integer. Student roll number. It cannot be so portable that I want to store it should be with the sale Okay, maybe same type. So, same type of homogeneous condition a limit can be stored stored in Lake the way you enter data into the list in that way it will be there. So, see if I say let me explain that example. If I say I have roll number 2256 I have roll number a coupe nine, I have roll number 45 to 69.

So, the data what you see this is one thing if same data also I can revision in different way, okay 45 then like soon 256 then I have so new 269 the nice new age children, if you see these two data, what is the difference? So, this set of data if you see It is sorted out of okay. But this data accuracy it is not what it is the way we enter the data it is stored in data that way correct. So if you see the Sawyer what happened here leads to a collection of elements of the order we enter not the sorted order orders, okay, the way we entered which element you entered past that is going to be stored in the past index, the next element is going to be the second index, then third element is going to nest in nations in that way.

The moment we entered it is going to capture the next index for now a percentage that type of thing partially we'll see it here, then second element here, then third element here, okay. Ah not least, even something some like said and what will happen, it will automatically start the elements which elements would store past and which not. But when you string when you send this element, it is the collection of elements, the way we entered, okay, it should be the same date. So how we can create a list in Salesforce when you say we're going to create a list in some stores nothing but if somebody says create one variable, which is going to store student name what we did, we did string man nothing but my data, then my variable name nothing but like student name, okay, this was then if need, I can assign some value here.

Let's see, I can say industry here. Now if you see if if somebody say, create a list commission, nothing but you will have to use a list template a list collection name, keyword. And with that this list is going to contain what type of data what type of person, it is going to construct a populism or it is going to come to an integer type of collision. So what type of data are going to store this list? Then what is the datatype of this list? We have to specify here, then specify the list now, you did do each one then I look at some memory new list of get a date.

This is the syntax to create an illustration, I think what least my datatype name, my collection name, then I look at some memory with using new keyword. The moment you do this one for example, if I want to declare an integer type of list what you do here, list type integers. Okay, let's see. Let our writing integer list what will happen here, new list of integer Okay, you should just watch. If you see this list indigeneity list new list of integer. The moment you write this automatically in system what will happen?

So let me delete something from here. I'm deleting this columns to the left and that list out is going to stall right now in front of us okay. So now what will happen the moment we declare this so it is creating one list just this much nothing else and the name part we have given here integer list, this is going to be the name of the list. So, for this list the name is going to be let me type your integer list okay. So now, we allocate some memory as you see in this heap memory, we just specify some space to my integer list okay. Now, how we can store the data to eat okay I specify if anybody wants to create a collection of the list of the datatype we will use this one if anybody want to create a collection of string take nothing What same way least up string Okay, then my List name nothing but I am writing the English test.

Let's see I'll give proper name student name list and I just received a new list of string okay a lot this one nothing works same way again creating a collection of memory with near Mirza student ever used. So how then I can manipulate with this list. So there are different methods provided by Salesforce to work on that. Okay, I'm just listing out all elements. So passing once I have the list element, I want to add this collection Hello whatever Yeah, I just mentioned this 45 to 56 to 69 Okay, so this below what I entered I want to store in that list. So how I will store here, okay, I want to store all these values.

How will stuff that means I want to add 256 the element to my list in this list. Are you on are at 5859 to my list, and 45 to my list. So there are some predefined method given vessels which we'll discuss about that methods. List methods, okay, what is this methods? So see, I have one method, which we call our method, I'll explain each method one by one, I have another method, which Colorado. So if you want to add element to the list, you can use these two methods.

Let me do this to romantically I'm just going to create a list collection in my window, okay. I just created least type integer, I just gave name as integer list. Let me make it big. So that it will be visible. So new list of integer Okay, and if you want to print any message Normally, we used system debug, okay, in the system or debug what you do whatever message you want to print, you can print. Okay?

Let's, I want to print this integer list value, what do you have now, if you see now, I have a look at some memory card a new list of integer. If I click on execute, let me show you I just click on execute, okay, so if you if you write anything in Developer Console, and you want to process that, if you want to process the logic or the right or you want to execute it, just simply common intuitive, if you want to include a specific lines, okay, just highlight or select that line, and click on do you can see here and once you get to Salesforce, buy in back end, generates a log, how much time this line process how much memory takes everything. And if you want to open that log immediately application, just click this and open log in. Now I want to open the log at one big good The moment I click on any good, so I send a request to server 2% And once it processes generate my log file see it's very good to understand this log if in real time when you work with program a lot of things so, they a lot of issue comes on your debug to find out the root cause of the program to debug This is very important thing I love complete one system to how to debug the program how to debug the soul, okay, you can see the execution start by the seizure at this time Okay, the joy there then see the execution shutter.

So who is caught saturd from the illusion passion setting the code, I think what may anonymous window which I clicked into good, this we call our ms window, we are starting this anonymous window. If you see then see how do we do what we do. We came at line number two I have a usual debug so nothing but my debug statements. I have capture line number two that I'm printing. If you see the line number to a depot debug list, then nothing is empty. See I have nothing because my This contains zero nothing, okay?

So that that kind of thing happened then no part of the resource we used everything in here and we completed the education. So now I am going to write the data one day one year past I said I have one method, which we call our Okay, we can add one element. Let's see what we can do. Let's I want to add integer in this list I want to add another element which we call this let's see 269 Okay, so after adding let's This is the message I wrote before are my body least mellow once they are what is going to be in between these so called data I have in made the list I specified after partitioning the list now right now I'm going to do it. So I declare my integer here my lease violation, and I are going specifically limited in this. Let me try clicking Good, we'll see what's happening.

So if you see, I came here. Now we can display in display so you can see my entity list contents to session a one by one I'm going to add the elements. So whenever I say our elements, so what is what is the syntax of this art? It is nothing but here you can specify which part element hello you want to add. Okay. So this element value should be same type what we define in the string if we're going to add the string element, then parser string value, integer element in passages are nothing but how it's going to happen.

Let me explain that it is going to happen my list name dot r, okay? then eliminate Velcro. Okay, we're going to art like that. Okay, so ladies, I cannot many values. Let's see our position or in Right now I'm going to add another value, which I call 29. Same way, I'm going to add one more value, which I call 569.

Same way, I'm going to add one more value, which I call 49. See my past element too soon and then to renowned and position and important in navigating the way we entered the value the same way that I will restore C to Sr 929 539 49. semiconductor. any confusion on the add elements? No, no. So I'm feeling bored or out of the discussion. Anything you can tell me freely?

So the practical lesson Actually, no, actually it's useful. Yeah. Perfect. So how to classes will be more on this Saturday basis. So slowly, we will learn the input concepts you'll get more ideas. Okay?

So bear with me for our students. Okay, so well we'll declare these integer lease conversion rates the basic things like you're learning the ultimate strike now, if you don't know the alphabets you cannot make the sentence to make the sentence in redonkulous a way to write a good program these are the basic concepts which we need to understand and the main important concept you will see least collect some list map and set very important things. Let me show you this main textbooks. I love very few classes here let me show you one class okay see if a quantity supplied is converted from dummy class okay. So, let me go for the boot class. So let me open a class well, so we will see there is no program where you will not see the collection use.

If you see that it's a program there is no collection, then it's not the way we had to go down. So this simple framework codes T, one day we're going to write this kind of program and I'll explain how we're going to write okay? Don't we came all these conditions relatives, Cory, everything will go into right okay. Now you understood in the latest way something called odd odd method, which are a limit. So like this consider I have two collections, okay? Let's I'm just copying the completely code, okay.

Same way how I ended the list I have, I am going to add integer list to Okay, by example, so I'm just I need this tool usually to for a salami limit, which are same as integer list, or timber to session and orientation. But in in and also I want to add some f try element nothing but let's 17 dot odd there you name so if you print this integer list to again what data I have no say in individually as to I don't have anything let me exaggerate I'll explain why I'm adding the two times for the one basic concept here the moment I come see I'm not excluding these completely I'm just showing the debug lines not the past when you go here click on this new only it will show the divorce documents only which we have written this system to debug. Okay, to see that we create we just click on this debug and we see the debug before are indeed the latest one we have this on this till this point we understood.

Now we can add these two in the original is to read all elements of integer one and two Nearly men 78 and 89. so far that what we need we just detain these pipelines of four lanes repeatedly which we have already and this collision we have already solved nothing about this thing example. You have a student list, okay? who regularly comes to the college and who goes to library. And to that list there are some other guys also who comfortable I regularly. So if you see the two lists of to list of students who comes to class there regularly and who comes to library regularly, if you see there are some students who don't come to class but comes with it, and some students who come to class and vocabulary so the library is nothing but a combination of who comes to class plus extra elements.

Okay, so already you have a list of student names who are coming to class. Okay, and you want that list last a surname nothing but same way this list of integers last extra list How will our instead of writing again and again can I delete this most thing I can there is some way to write this list element directly here nothing but can I will delight adding one list element to another. Is there any method yes we have if you want to add all elements from one list to another list, there is a method which we call add on okay. So, that means 42 So, we can use our method two adding all the elements so, which list you want one I want to add the list of elements coming from where I want to add a list of elements from this integer list to in digital these two, okay nothing syntactically fails nothing but okay destination list dot RM shortlist Okay, this list can be leased or can be set any collision or vacancy source collection okay that way you can use other live see the same thing it's a good use of those similar book but with using is just fake pencil I was just speaking with her currently traditional thing word adding element.

So now see okay we are at 269296 and 497889 but let's I want to add one element after two session before cleaning. So if you see this limit okay let me copy these you see here. So this is not a word we are at this type of elements nothing What I can say this is completely one connection. So if this is a correlation this is nothing but index of zero troit so for your better understanding, so I are at this location represent as zero this is nothing will represent as 123 all elements represent as one index and how many limits you are okay minus one you need a maximum index size index at zero. So now in this part if you see the hospital event which totals to 69 so here nothing but you can see something like 269 Okay, same way second 11 nothing but I have 29 Okay, so, like that maybe I have highest it's been nine.

Okay, I have 49 all the elements I have here. Now I want between these 269 and 249. I want to add one eliminate I don't want pone nine to be index one, or 2692 index zero. Okay, so what we can do here, when I do that we have some method or thing, but we are going to add one element at index one instead of this 29. I want to add one eliminate index index one. Let's see how we can do it.

Same program. If you see, let me take these elements are there, right now if you see my collection of these elements from this sprint, if you do mind collision of this limit, now what I'm going to do, I want to instead of this 29, I want to 129 that is my target what I want. When I have 29 I want only nine should be 129. Okay, so instead of I'm just going to and instead of removing something to do I just am going to ask Another element one today in this index, this is how to limit your index, second even numbered index one. So in that time what I do, I am going to add one element. So I use our method, one element to one particular index at index two one I'm going to add 1.9 after I am adding this index what I do, I will just train this message to see what is this?

Okay, so initially is to after are in index one, we'll see what data are coming. I was printing it if you go here. Let me show you the log. I'm clicking on the debug log only. See now, before I had 26929569, the 109 came to hear and see how it Kutta now Kim, I'm just copying this So that you can see here okay after that what happened my data came in this way to session in there. So 129 just we kept one to the name at index one and all the elements of auto sector.

So, if you want particular element to be placed at one index okay then you use our method with index and the element value nothing but this our method Part Two Yeah, it can be also used as this way Okay. All right. index number, element value, which we can say nothing about this way. My List name, dot art index number and then what do we Understood any confusion? No, we have duplicate value as well in the list. Yes, I was going to there.

So now see, I am going to add on this element like this tonin in a pipe system and I want to our why once again only nine after 49 Okay. If I do it I execute it okay. So see there will be a duplicate eliminate, I will see 29 and 20 in India, because why it's happening? The list collection is a collection of and for the wave, where do you enter the value in that way it will enter it is not doing anything in there automatically. So in that time, so when you have this list, let me write a list, right create a in collision here. Okay, let's This is a collision problem.

So now if you see I have entered 129 instead I entered 49 it will be there I entered 49 is there I enter 29 is natural limit I entered 120 isness filament. So what else will you enter no matter suitability there but Ed Sullivan automatically suffered what will happen if this is the same thing I do. Okay let's I have this collection and I entered 129 August the next time we are recording so Tony is not going to store you. So what will happen? The system will go and these players will keep the 29 okay and he this place will keep 139 same way if you want to keep or whatever and it will see where to stall. Okay.

It will take only nine what I'm trying to enter here. It is less than 1 billion it will try to bring to here but I Getting to see the previous event tune in it means that it will try to bring your same value and this value is not going to add in a list. So, if we have this approach, then duplicate not allowed this type of thing will call us it which are going to talk next collision element. Okay. So list allows duplicate right. Now, you can make a list in a collection of elements of having duplicate values and each value are not sorted by default.

Okay, so now see, we added these elements we do it, I want to make another list of completely same Hello, I don't want to do anything arrays, I just want to clone it. Okay. Now I can make a duplicate copy of the same thing. I have this internal list I want to make a copy of the same list that I do here. Same way you can do okay, whenever you Want to learn something? We have one specific method, which we call clone.

Okay, so I, let's see, I just wrote one model digitalism clone list, you can allocate some memory also if you don't want, you don't need to allocate memory. You don't have to allocate because you will, we're going to refer to the same collection. Okay, so now in this clone, or elapid, we'll just clone the elements each element will clone I have a method which we call clone. Okay, what will clone will clone. This is a list okay. So when you clone a tumor, it will clone all elements with their memory location.

To this new collection, okay. And it should be of the same type. If it is if I want to clone one string type of polish on to integer type, it will learn aloud to me. So all the elements should be same type to be cloned. Okay? Now the word loan makes a duplicate copy of the list.

Okay? So when you clone the DLT, we're going to return a limited list of some elements, okay, like a new art, it is not returning anything, it's just adding the element to here is returning part, but when you clone it is nothing but completely pulling the levers. So how are we doing here? So, this is going to be written this way. So what do you want to learn? I want to clone integer list.

So that means integer list to be clone. Okay, if a clone file store the duplicate data, I want to throw the duplicate data on the police. So go here, right Like this. So, clearly SQL row integer list dot clone, if I wrote this, let me print this clone this fellow I go and execute it and I see in the debug log to 2016 and this is this fellow and this fellow is him. Let me take this to a nearby see this remove both the regular sim to session and 29 isolation and 49.9 printing. So, in this way we can clone it or when you do clone it modify to 42 feature to eliminate to clone and it will emit us destination list equal to source list.we have considered deep loans alone which we'll talk about And stuffings.

Okay, right now we took a clone. Okay, now we have so many limits and I don't want to keep this limits, I'd want to clear all the elements from into the list too. So to clear the limits what we do, we have a method which we call clear. Okay? So simply you take all integer list dot clear. That means it will remove all the elements from my list.

Okay, let me see it's removed or not. So I'm just going to see the debug lines for this integer list too. After I click exhibit, privacy, I come here to all elements gone. After clear, I don't have anything here in this release is over. Release two was something on Hulu. We had release two Now the limit is completely empty, initialized to empty, but before you see we have some value here.

So that so if you want to clear all the elements from the collection, simply we can use clear nonsense. any confusion? No, no? boarding, everything looks eg. Looks good. Just one question.

Can we create a put a particular number like through the index value? Okay, I'm coming to you. That's, I didn't clear this one. Okay. I want to clear the element. This from the least to this one.

Don't even let me show the output. So we put I heard one word in English. I want to remove this element from index one. Yes, we can do it. We have all kinds of concerns, predefined nothing to do. So simply I come to in detail as to Okay.

Let's say I'm just going to use this again. I didn't clear now I just commented this line to come in the lines to just do this last year in detail is to say there is I'm not clearing the value, I'm removing the value from the list. I'm clearing the list or removing them from the list removing from weighing removing removing from the index one, use this data frame this Okay, let me print this chapter removed from one. Okay, let me see. Now one tuning in gun from my list, correct? Yeah.

Okay, so No, I know she there is one method I say to you about either at a particular index skirt. But you don't think about this one. So say my let's see, after reading I want to do the same kind of thing. But with another method, which I call set. In this integral is to I want to set one element which I call 333. at index one, we'll see what is happening, okay. The difference you can see and what is happening was we can understand and explain, okay, so see Delta method add on one method we call set.

We'll see if we can hear you activity click this scene. Is the eliminate well I have a limit to 69 129 trillion but when I do sit I lost my previous value in the next one but my point 269333 trillion but before you see 269 tonin in taxes in the moment I do our index one the eliminate button got added in index one and all the elements are shifted one point A to said no element is going to be saved. I'm just completely replacing the in eliminate from that index got difference. So, how are you have our elements same way I have some elements so I will discuss what clear Okay, we discussed about remove a particular index Okay, I will discuss set element, our particular index with a value which will replace that current index value with this new One clear Yes. Okay. Samer, how do is to say okay how to remove I want to see see right now okay, you can see I have only five cc elements, sometimes dynamically going to get the record from database and storing the escalation.

I want to see how many elements stored in my collection. I just brought dynamically some Hello ladies how many students you have, or how many accounts record students collision. So if you want to see that kind of thing, we have a method which we call site. Let me show you that. Let either integer total size equal to my integer news to your sides. Only record that it will give me and get number of common elements out.

Okay. Listen, I'm just printing this thing about total number of elements total In this collection, I just figured if you see here the total is seven elements that means 20 to shipment. Total is when elements. Okay? Clear? Yes.

Perfect. So as I see by default list is not sorted. Let's see, I want to sort the elements. What I do here simply came here I just went here I just wrote integer list dot sort. If it was something like this What happens? Let me see if something can be done now.

Copy this one. This will be listed right for me. After cert let's see the moment to integrate what's happening. By default not being setter, for the moment I wrote the sod method, automatically the elements are certain but duplicate element will be there. If we have an indicator element, but elements are sorted now. Okay, so now we understood about our add one element or are there multiple elements to the sample exam or clear the elements are cloned of one list to another list.

Or maybe we check the size and they set a particular element remove a particular element and sorting by default, correct. Same way. I have this many limits. I just want to check for example, you want to check is there an issue with name addresses? Okay, so we have a collection of names and you want to take each diligent experience with name addresses. If that means that collection option contains anybody, with Nemesis even shake their hand We have one method which we call contents.

Okay. So now let me show you. I'm just writing see if laser prediction datatypes Boolean, okay. And check eliminate some variable name I get. Let's say you want to see an integer list to contents element which live in it contains one element, nothing but which I call coordinating. Three pertinent valuator.

It will show me the output. That's true for it. Boolean nothing but will it or not true or false? Let's, I just interpreted Either element two is showing me true that means 49 is a limit I have in the list so showing true let's I just put in the sample SM plus as own 99. So, this checking event will determine me as false. The element of if you want to check a particular element contents in the list or not, we can read the contents keyword.

It's false right. The same way you can use get method set method an equal check is if your list is completely empty or not semi you can use is empty. It will return you the collection is empty or not. For example, if I come here, right now, it will check Boolean is empty list is empty check that I want to check this integer list to empty or not. Okay? Now see paper in this collection destroy this Boolean plot here.

And I see if I do a GMT check it is nothing but nothing empty the moment I clear it so now you pay go on a Ducati and if you see I will tie this ticket let me do it Boolean. Let him do it again. You can see here, let me open it log. See I will explain this Tableau console on fiddly but now we are focusing on this specific part. Now, empty it's not empty so I'm getting a pulse. Let's see this in detail as to I'll just go and clear the elements I just made as clear after clearing if I want to check this again.

Okay, we will see that I'm getting a script See before what happened it was not empty. So pass I got calls okay EDM detect calls then I cleared it then I check it is true. So, if there is no element in a collision, the EMT will return me true. So, there is there is see these are the methods you need to unremember Okay. So, slowly when you write the program, I mean power logic we need is something you have to in if you are going to update accounting database question though your commission contest element or not, if not condenser side CMT, then do not hire any database presence, when you do that kind of thing. We will use this methods to this method for basic of the programming which can be used to estimate here any confusion for these lists collections?

No. See if somebody asked you what is the least what to party what will be your answer? ls just a collection of similar type of objects similar type of data yes store like like First come first so or something like that stored in a yeah in a periodic or something yeah. Okay. So, that means let me tell you the technical mechanism for this I just explained so called you understand class, then I prefer to tell technical definition if I tell technical definitional cause, you cannot map what it is. So, whenever somebody has a list, you can simply say, a list aegeon ordered collection of elements, see order is not in sorted order, the order you call it the elements.

So I said ordered collection of elements. Okay, not a sorted order. It is the order the way you connect. So just come back toward at least as a region or a collection of elements okay which can be distinguished by their index okay. So, can you have duplicate values in it? Yes.

Yeah, may contain duplicate value also. This is the main difference between set and least main content duplicate elements. Yep, this is the one okay and when I say the least I define least datatype that evening. So the data type of the list can be primitive paid off So, can be another collection type. So list can be a nice type of data okay or it can contain one epics type but somebody gave on a subject type or maybe epics class type anything can be. So now I explained example is list of integer list of string same way if I want to store all the account record in a collection, but I do least have account you know the equities account record Yeah, yeah.

Okay. So I can give name as the account list for there. What do you do here? new list of accounts. So if I want to store the account type of data the same way if I have create a class I'll explain how to create a class how do I declare an IRA class name as let's see, calculator class. Okay, some something I can hear instead Where medically and I want my knees should contain all the object of this one that is what we can do.

Same way, at least of my class name. Okay? My my attic type okay. calculus equal to newly stuff. It can be written in this way also, same way. It can be a list of primitive types or import like list of integer type read what we saw in different examples.

Okay, say my boy, Nick, come here. Let's see, I have this integer. I want my limit going to be the least of this type. That means what I want Let me clear this diagram first. Okay, this diagram we don't have to say but it is called doing it. So, I have one list elements, maybe two element or three element, I have another list element.

I have another list to limit, like these are few English elements, there's just drag it some elements. Okay, let's do some values there. Okay, I'm not adding any value right now, I want to see if I didn't say this list, let's consider all the dessert table. So this is nothing but I declare a list of integer I in at least one. Sam way, this is a declared. List of integer.

Sorry, are you going to list to correct that means inside this I'm going to write one integer value. Maybe one six nine something occurred. So, this is one list, this is one list, this is one list, I want to store another collection of elements which will contain the list elements. So that means I want to have one more list okay. And in that list what I want to talk I don't want to study integer okay I want to store this list element completely this one I want to store okay. I just want to eliminate this one I want to add another element, this last one personality limit nothing but a pay See, these are all going to be one one elements.

So nothing but can I say this is contains the past index, Euro index, or one index going to condemn one list. This is going to contain one least correct getting my point Yes. So, now how I will declare this okay. So, for that what happened? So, see, when I declare this this is what type of element This is integer type of delivered, so, I mentioned integer, so, this is what type of element This is contents one list element nothing What can I write this list as a list of this is in fact a member than my this is my list collect some name. So, in this insert what type of data Am I putting another list type that you can see this under So, this party that a collision eliminate or is towed elements, which we call us list element nothing but this part.

Correct. So, like these this is the one local industrialist and like this, we can make pipe level industrialists. Nothing but I want another collection okay which parts filament going to be the complete this set right. So, what that means everything I can keep one list element in another list nothing but this way I'm just writing See I was given a space to understand you know i guess i you NT I introduced other understanding. So say my new list of it can be any type, I'm just giving the complete integer. Are you understanding?

Correct if I want this is going to I can contain another level of least necessary list. So I can do pilot industry. Instead of this integer what can be done, it can be another collection of a limited understanding of Configuring an all set method if you want to have another one so same way I we can create another list collection instead of this type it can contain another list I'm starting one question but their data shy data type should be same right? For all the lists which are Yes Okay. Yes, all elements will be same. If it is needed element it's all these should be digital.

So like this is now three levels. So like this we can go part of high level novelist collections, okay. So there will be a task for you. You practice this literalism and see how complex list you can make all the methods of same everything is same. So I let's see if you can create a list of at least three level Okay. Got all concepts?

Perfect. Okay, so I close the session today. So tomorrow we'll call discuss your set and map. Okay, then we'll go to the database Perfect. Perfect. Okay.

Yeah. Okay. Thank you so much. I will. So this time is comfortable for us. Yeah, yeah, this is okay for me.

Yeah. But you only use chain which which places Hong Kong on the hook is perfect. Okay, we'll meet in the same time. And thank you. Thank you. Sorry.

Thank you. Yeah, if any questions we can discuss in the next session. I am okay. Yes, sir. Thank you, baby.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.