Tip:
Highlight text to annotate it
X
so if you want objectives he brings to the cable as regards arranged
quote we know that when we're working with strings we look for an extreme
and we're working with day to look for m_s_ dateline might make the assumption
to look for an event or a class and indeed
i have one
at the regular class an objective c which means we need them
pointer for it
so i'm going to pay one called my rent and ted it equal to know how do i make
this
but a couple of different ways
one thing you could do is we could
go along the road of using the usual classname alag unit we're very unlikely
just to stating that because and that's a raise want to be created with their
contacts
so the most common and its allies are is
weird objects
i'm just going to give it the simplest way of giving in a couple of objects
here which is
inline created m_s_ strengths
and then there's a comment on the word nailed whoops that all about
we didn't say how long will the array was explicitly around a little square
brackets with the number two in them
so what is going to do is just coupon adding new object to the storyteller
hits the word nell nell needs to be the last thing whenever we're creating this
this will give me an array
i have you been motherboard along so i would need to paradise with any released
statement
although if i wanted to there is
age shortcut method to create an or to release terrain
which would be instead of using the word alag
ideas make a direct call to an s array
already with objects instead of and that was objects
i didn't use any on the no records here knowing you know how long can copy north
came so i would need to call release on this
you begin to feed this kind of example used all over the place arrange strings
dates all use it
amended prove potentially working i'm going to
change my long message here to spit out something
the second element it
well we expecting back we're expecting an object to my place holder will be
percent playing outside
and then how do i get to that element
well you might think that we could do something like my array
square brackets one
but that would be the feast on a way of doing unemployment or kya
wherein objective he were calling methods for everything so what i do have
is i am doing the maya rain
and probably the single most
common
method for working with a raise
which is
object
index
this method
will take an argument of an integer and that kato putting one together i think
an element
and i will return that object
david run-up
and not surprisingly we should get out of the second element is
they might not see an awful lot of improvement here but there is quite a
big difference with the working man and that's a raise
one thing is
aiken loaded with pretty much what ever i wont let say i create
an n_f_l_ date object hill calling my date
and all this created with the full on alag and inept
what i can do is when i'm creating the terrain
i can just past bad in
as one of the objects
we can't have strings we can have a date we can have videos we can have anything
added to an an aspirin only cares about
is that there are objects and that
doesn't care what kind of objects
now this lead us to an interesting thing here
i've created a this aneta dates called my grade on line nine
an amusing alag and annette
so i need to pare that with a release
well interestingly what i could actually do here
is and we'd really call release
on my date once i've added it to the iraqi
mail i think
will hang on a second what happens
the data object goes away and i'm trying to access that element of the right
while we're okay
because what actually happened when we added to the annexure a
in vienna to reduce it pay retain call it will take care
of keeping hold of that
when i'm allowed to nest eight of them
i'm done in my code within unrelated
and while you can of course
use your option click to jump in and see that there are a whole bunch of other
methods you'll find that array with objects or unit with objects and the
object of index buried muncie common terms to work with your reading on the
array elements
to browse through the documentation at some point
and see what else seems useful for you
however
here's the biggest issue you're like me to run into
an and that's already on junk is immutable
immutable meaning
unchangeable
once it's created you cannot atm you object to it you cannot remove objects
comment
it's a fixed size
now i'd already said that was a limitation of the regular seized on the
right nice we're gonna fix as well we can
three a lot of the time any immutable arraign is just fine
you know how big a needs to be you created with the date of the timing of
that sometimes you need company but more flexible and we can do that too
well they can do is change this declaration from and answering to
enhanced
municipal
an overhear change my initialization
to m s immutable arraigned array with objects
and asked me to go array is a subclass of m s array which means they can't do
all the things and that the rage and but it's got a little bit extra
functionality to
so what i can be absolutely has been created
and i can call a method of my rain
cold add object
and it doesn't exist
admire a wooden an answer a bit of adjustment immutable array
so if you mean that flexibility
this is how you get a not only that
but you have the ability
to remove object none of the few different ways of doing it
one of the most common ones would be removal object at index i'm in the past
and the number one
now more than should do
is removed
the entire string
to from the rain
collapsed an element
and the mind data object should now move into that second position
well down online nineteen i have an and i thought was going to write on
whatever's about second position an odd one more peace to rent
but just as in the arraign count is
so we can find out the length of it this is going to be an integer
was doesn't mean that the first thing after the colonies to read my array
and his a
moderate object at index
the quickly run an astounding that the arrayed talent is
which is what i think spend now it was three venite added one and i removed one
and the second almond is and we're getting the output of the date
now during the eggs
complaint here
conversion specifies tied income
but the argument has tied
aneta you integer
also known as unsigned long
and if you notice here
what it's doing is giving the ethics it
tuesday that it suggests that i replaced and placeholder percent body with
percent tell you which is for an unclaimed long integer
and then simply because of that is how we
count method as defined
and he asked me to go arrayed object and indiana soraya object
well except that the trip
other short works without him
but this will now no longer give me warnings
and what we can get a bit more complex with other more specialized classes when
working with
collections of objects you're like me to see and that array and anderson usable
rate used all over the place