Tekshirdi:
|
I.Sobirjonov A.Qo`shmatov
|
Imzo
|
Bajardi:
|
653 -18 Mamajonov A
|
Baho:
|
17-Laboratoriya ishi
Topshiriq: Ixtiyoriy ro’yhat tuzing unda ma’lumotlarni qo’shing ,o’chiring,izlang.
import java.util.PriorityQueue;
import java.util.Scanner;
public class salom {
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
//FIFO steklari haqida qisqacha
PriorityQueue navbat =new PriorityQueue();
// offer() navbatga azolar qoshadi.
navbat.offer("navabt-'Aziz' niki");
navbat.offer("navabt-'Otabek' niki");
navbat.offer("navabt-'Sardor' niki");
navbat.offer("navabt-'Tursinali' niki");
// remove() izlab ochirish
if (navbat.remove("navabt-'Tursinali' niki")){
System.out.println(true);
}
System.out.printf("%s\n", navbat);
// peek() 1-navbat kimniki ekanlif=gini bildirib beradi;
System.out.printf("%s\n", navbat.peek());
// poll() navbatni ochiradi.
navbat.poll();
System.out.printf("%s\n", navbat);
}
}
Do'stlaringiz bilan baham: |