Puas yog vector Push_back xov muaj kev nyab xeeb?
Puas yog vector Push_back xov muaj kev nyab xeeb?

Video: Puas yog vector Push_back xov muaj kev nyab xeeb?

Video: Puas yog vector Push_back xov muaj kev nyab xeeb?
Video: স্বামী স্ত্রীর ভালবাসা কেমন হবে? কি বলে স্ত্রীকে খুশি করবেন ? Mizanur rahman azhari new waz 2020 2024, Kaum ib hlis
Anonim

Nws tsis yog xov - nyab xeeb vim a vector yog sib txuas thiab yog tias nws loj dua ces koj yuav tau txav cov ntsiab lus ntawm a vector mus rau qhov chaw sib txawv hauv kev nco.

Thiab cov lus nug yog, yog vectors xov zoo?

Vectors yog synchronized. Txhua txoj kev uas kov Vector cov ntsiab lus yog xov nyab xeeb . ArrayList, ntawm qhov tod tes, yog unsynchronized, ua rau lawv, yog li ntawd, tsis xov nyab xeeb.

Kuj Paub, HashMap xov puas nyab xeeb? HashMap yog tsis synchronized. Nws tsis yog- xov zoo thiab tsis tuaj yeem sib koom ntawm ntau tus xov tsis muaj cai synchronization code whereas Hashtable yog synchronized. Nws xov - nyab xeeb thiab tuaj yeem koom nrog ntau yam xov.

Ntawm no, qhov twg zoo dua vector lossis ArrayList?

Vector zoo ib yam nrog ArrayList , tab sis itis synchronized. ArrayList yog a zoo dua xaiv yog tias koj qhov kev zov me nyuam muaj kev nyab xeeb. Vector thiab ArrayList xav tau qhov chaw raws li cov ntsiab lus ntxiv. Vector txhua zaus doublesits array loj, thaum ArrayList loj hlob 50% ntawm nws qhov loj me txhua lub sijhawm.

Vim li cas vector siv hauv Java?

Vector hauv Java . Vector ImplementsList Interface. Zoo li ArrayList nws kuj tseem tuav cov lus txib tab sis nws tsis tshua muaj siv nyob rau hauv ib puag ncig uas tsis yog xov raws li nws yog synchronized thiab vim nws muab kev ua haujlwm tsis zoo insearching, ntxiv, rho tawm thiab hloov tshiab ntawm nws cov ntsiab lus.

Pom zoo: