50% found this document useful (2 votes)
2K views

Java Collection Framework Hands Written Notes

Uploaded by

harshit kuchhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
50% found this document useful (2 votes)
2K views

Java Collection Framework Hands Written Notes

Uploaded by

harshit kuchhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
¥ Collection Framewrorft- ¥ # Collections In Tava = The 6llechen in GI dy PrAmowerk thet Pues an couchixedute. fe ghrae and manipulate. The Group object ; > Tay \ , : @ Cellechen an achieve all the gperahien§ Thar qe nee pefomn on a data sth %% scorching, . SOYA, indcrhony manipudlatin end deletion 2 Twa odlection monk sg Myke anit & object. Twa Codlechen framecuonk pecovieley many ink wpe (St, List, Que, Dequt) and classes C ArrayList, Vech¥, Linked List , Pruionity Aen g Hagh Set Linked Heaeet Trees’) A Coltection, su paesente 4G singhe unit ee elect, re, gary. + FocamelWonfe = + $¢ pocouidig 9 Readymade frehyteehas +H eepeesent a set & LASS ond inkefeces tae ephenal. x Collechen Framework. = The callechen Frameworg, $pReserdp a united — archi Hechhae for shang md mantpulatin ; pala’ a peup of objet. GF heb 8 7 fe INKY FACS — and cit impdementahons, ce, classes 2 Plgoaa ths (@ scanned with OKEN Scanner — Tava.ebiy peckage confednp all the klassc amd ink YGaces fer tht codlechen frameevroyr HO. peogaam can Keep sefeunc? of ebject& into: i j wld be use 1 Rekoenco Variable. ~ We bho ‘ Sen ae program want te KecP mehr . de ingle objec ol a Aoway. + Tip whould be used ant ae progam wankg tt Keep. aefrenc i m ie oon) 4 sare class (when number f objel® aiak showlsl br» ured when owWL & Collider. Kup aefrcnu dy mal pet program wane 26 f obyellg ke samt or oli fhe’ ent class ( when num g objects co nol Known “5 Gt means CollecHery can be wrtd as hemegencar) as whl AW bean Hehrogeneoy 3 ArrayList < Employee? cl = nw Prvauist< Employer?) 5 I] ollachen CL cin homogen eds - 94 tan peep objete Employee class only: fe favayligt CL = new Arawaylis5 i Goltechin CA a hebrogenegp - oF can peep aby Roane — fy ewety C4A8S (@ scanned with OKEN Scanner 7 ear call methods above class] coblechan chess aD perform following Teak apereetyen TAR ony the uging Colbechen methed ous wpa oR Belling nur eledhent (objec) into colle chen. 2) Rem eving elemenls hom the coblechen. 3) Theating Elementg (lot element ont by ore bor oe 4) Seatiching Ettmente 5) Sewting — Eltonen!a ©) Update Elemente aa 1D Replace Element BS) Shgewt Edemeute ete ¥ Collecten Inka fee 3 Collec Anke pee Colleen — InKr pe a child Tpeable tnkarfece- ; ' a rs ae t, ae acl Bees etter alt collection cls} — Remembe® codlection PamewerK way inboduce in TOK 12,» whide Thewable interface wag ones in TpK |-0 ly BH Meh fodlowing three child — Anlerface I List inher feet 2) St nterfeece 3) Buene nko fee ~ These jntoferte ware alo collec Pop. gt meang, arose ile gare are having all methods | behaviogr 4 Cellechon infertreles Reiter child shoul have rege mithed, 4han parted (@ scanned with OKEN Scanner yu therarchy 4 Collecton Framework, r- Ines Go ~ Class Tkvabl]® 1 extends t * — It mplaments 22 Whicthetr class and inkifice ino this, “AR ce class te implends by BB Inerie f 7 ap wes Borel Interface Con only exkndh bY a 88 Co the pp cs adfe Faber fee T implemeot — pm r& ¢C Class HUT Dp ae iS a class cohidhh et ex thas, by C eC ay cele oD (@ scanned with OKEN Scanner bo . ) Uist Gnitrpeee. & Gf dy 4 child calle fin se inom ee ~ FH bed fedtowing. there implementing class ') ArrayList — Css. DY Uinkedlist cbss- IBY Vectra Clas ~ Objects qe these c.lasces CPrrayt ist LinkedList, Veckr® Should he pecued aS List — Coble chen Peatunes ob List Collection. = Hos an ordexe Collechen, ST ODE gallows, luli cacy of elements 3) 5k allows muliple null veld — lst inkr fact hus all mathods 4 Colteeten Ink rfecée — 9¢ hud severed own tnyethed — data will Rept intr object & pocog74™ Refrence ef these object Kept in codiechen by prospem ~ Repent Rept ink collector oy peaked Ee codlechan ° cae = Remember all Class and inkrfrt® q- colltchin fame, OSL gunerit soe — Dur 42 generic Ute , we coe able te crtalt homens, eo, . Colle Hom, - Cliche Framtwosk woos inboduce in IDRI-2 wiitie genni Hare wor inboduce iq IDK 1-5. — > headin. = Dgin Zensen Coli © Dining meer pee — a malliple time “in a ekeas. “A Recto (@ scanned with OKEN Scanner List coUlechen, ust da an Snore - I+ do chdd g- collechey Inter fark 5 fodfocsing thare impde menbaly — List inlvface bh te Ie) Prevery Lis QA) Linked LIS Vechoo C4985 4d thege dass Soe ae aaa «hse. Cobte chem List Collection wtf manage sue drent 4 objects (thene obj ecte thet cone projram's data) ‘ , : L # Array List Chass. J+ ob an mplementehin + tao Intafau, t means collectinn 4- thig class ot dublicacy f- ele . = Cier pawopam can creeds and we obpeorp this class a Lit (olfechen — frvaylist wh an 90 rable awey Xe Gye elemrtnt - cntid Size dt ship eon uh [0 aw, dtd! Ace 4L Std Pocodu} > St = neo A ayeny List Rise > new ArrayList OF % purayliSt List = Ated Arocylis Ime? O3 Ye aray bist dist = ned froaylist O 5 Nt wil ede A resizable qrdey and type yeh es and §r2e 10 (@ scanned with OKEN Scanner F Ke sizable foray Skep& int numC(] >= nw int CLO]. hk eat a nae Arey fe move Ste Md Less see Hint atrCI 2 new int Cae¥ num Length ¥ 2) % bony eet ales Py eth value & fiast vray (rum) one? Aryay Care’) ido BI! Assign acfyenee unordoyed Collector J FH dow’ mot allow Atel ca cy of element” >) dt allow’ singlt nal value US g¢ had not muthoe! that cm peygormn WEE inkexpecce had ody me implumentehon class. Name 4 that class ti Hasselt H nad Set Chass di impdementalren Sd Gok Yfece ~We wn use This ColccChen when cur prop dod not want to oop dupliete element -iingicle Colleciin — Harb Sd Class uses ins dane | ebiect Neshbipap. clas te Store ement ~ Heshmap vid Hash tobe ingide et - Mesh ebde Cees arwery oe bucket fo Rech element ~ Gin feel epee size Hs away & lt byelafecelt te keep elemewe - St means sashfable coeaes 16 huge = pucker nothing ak wh an objet cf doubly Linked ist ~ Remember cath bucket ell be idenhfjed by ading 40x indey number ' fare avads < kj (@ scanned with OKEN Scanner 80 Inclex fice buqeee will be O and fasf eile ee 15 ~ Math Table calle following uso methods Fellow ng beter class intr nally. ID public int hastodtl): — This muthed vs colli by Hubteble te ger index ¢- bucket in ool element Wo te be cdleted &) Pablic boolern equnls (Qbject ob) )<- tis imithod cis called by thsh table tk avoid duplicncy Clement Thip method — will called cohen bnueebters = — 7 Bet me hathrode had alecady added into collectim. SF who same bucket: MUAbOe™ elemene will be checked Oe Hash Cocle. In jaug every objec hed an unique redo — number by clofa ult’ — We cn gee AMi® number by calling herlode O mathe d- Objecr Class — Hashcede number 4 Yo object will be dikhereer because this method will genoadt tlashCede number by eng aehrcne fe the object pbs! Shiny class and all Lowap ptr Chasses hour overridden this mothe ( 4 hes Code) method f— object Class) ; This hashlode muted sill genevebed Pesicad (@ scanned with OKEN Scanner Mmbex- 4 WING alt the object. Se ip , | Unt wig some thern hashtede Humber coil Gime q Sa ‘ Un Red fash Seb Hb a chile £ tlashSet Clas5 ~ Oneike Weshbeb uf co oxcteyed collechon Tee Set CRSS- o- Ht th Gn implementedten € Sort Sch infcrGeer. Ler tdid —inferface ob -a chilold- set inkrife Tet Se (ollechorn will KeeP elemenl2 in aaxendiing oye Tarek do& pot ellowd nell yalue, (@ scanned with OKEN Scanner Mab Glle ction As we Rnow That List tollechon , set coblechor amd qucet aa implementahen < Codlec hen Inkrpeece « oa coblechen ef> not implement 4- CoLlochn Ink wprece — Mab collection do» impdementation ¢& Mab Inkerfeor- - Map collechen keep element in Key~value precise: + Dur te Rey, dimen! can accessed cai. - Map Infor fect hed only. ome implementahen class: which els Hash Map Remembeor HaghSer uses instance} object of HashMap & Keep elemente ~Ih Hash thap Rey will alumys bt unique and valid CBF mopty element) con be duplicate 4 Hash Map < Integer, Shing? mab = new Hasap< Inkyer, Shang? j i : Oy Ke Vabet paim ingidde tlaghthap collec ten do unordereol Lin Ked Has nap (fas: ~ 3 child > teahinab ele ~ RG Yelor yelut pair inaiea Linked HashMap collichori uy prdertd: (@ scanned with OKEN Scanner “Tecee MNap Chass. 7 Hob an impdementation of Sox ed Map interpecce: Sex ted Map Inderpeeee lo a child of. Mab “jnlewgect- ~ ('WeeMab coliscHen keep Rey - Velie Pasa lenky) in the ascending — ey eder q- Key: ~--2 ea meececemee_eaeaeaeaeaeeseee2e22O2ee22eee (@ scanned with OKEN Scanner

You might also like