Dab tsi yog Deque hauv Java?
Dab tsi yog Deque hauv Java?

Video: Dab tsi yog Deque hauv Java?

Video: Dab tsi yog Deque hauv Java?
Video: Hmong new song 2016 - Yog dab tsi - Xub Hluav Taws (Official MV) 2024, Kaum ib hlis
Anonim

Cov Java Deque interface, java ua . siv. Deque , sawv cev rau ob qhov kawg queue, txhais tau tias ib kab uas koj tuaj yeem ntxiv thiab tshem tawm cov ntsiab lus ntawm ob qhov kawg ntawm kab. Lo lus Deque yog pronounced zoo li "deck" ntawm daim npav. Cov Java Deque interface yog ib tug subtype ntawm lub Java Queue interface.

Tsuas yog li ntawd, kev siv Deque yog dab tsi?

Cov Deque muaj feem xyuam rau ob-kawg kab uas txhawb ntxiv lossis tshem tawm cov ntsiab lus los ntawm qhov kawg ntawm cov ntaub ntawv qauv, nws tuaj yeem ua tau siv raws li ib kab (thawj-hauv-thawj-tawm / FIFO) lossis raws li pawg (kawg-hauv-thawj-tawm / LIFO). Cov no sai dua li Stack thiab LinkedList.

Deque yog FIFO? Ib yam li ib pawg tau piav qhia tias yog LIFO (kawg-hauv, thawj-tawm) thawv, qhov no txhais tau tias ib kab tuaj yeem piav qhia raws li FIFO (ua ntej hauv, ua ntej tawm). Ib variation yog hu ua deque , pronounced "deck", uas stands rau ob-kawg kab. Queue thiab deques tau siv ntau txoj hauv kev hauv kev siv computer.

Tsis tas li ntawd, qhov txawv ntawm queue thiab dequeue hauv Java yog dab tsi?

A kab yog tsim los kom muaj cov ntsiab lus tso rau ntawm qhov kawg ntawm qhov kab , thiab cov ntsiab lus tshem tawm los ntawm qhov pib ntawm lub kab . Qhov twg as Dequeue sawv cev a kab qhov twg koj tuaj yeem ntxig thiab tshem tawm cov ntsiab lus los ntawm ob qho kawg ntawm qhov kab.

Puas yog Deque xov zoo Java?

BlockingDeque interface nyob rau hauv lub java ua . siv. concurrent class sawv cev a deque uas yog xov nyab xeeb muab tso rau hauv, thiab ua piv txwv los ntawm.

Pom zoo: