“Antrian Kotlin” Kode Jawaban

Antrian Kotlin

import java.util.LinkedList


fun main() {

	val queueA = LinkedList<Int>()
    
    queueA.add(1)
    queueA.add(2)

    print(queueA.poll())
}
Shy Stork

Antrian Kotlin

val studentQueue: Queue<String> = LinkedList<String>(mutableListOf("Agni", "Bob", "Chris", "David", "Emily"))
  println(studentQueue) 
  studentQueue.add("Felix")
  println(studentQueue) 
Smoggy Snail

Antrian Kotlin

val studentQueue: Queue<String> = LinkedList<String>(mutableListOf("Agni"))
  val element = studentQueue.element()
  println(element + " : " + studentQueue) 
  
  studentQueue.remove() 
Smoggy Snail

Antrian Kotlin

val studentQueue: Queue<String> = LinkedList<String>(mutableListOf("Agni"))
  val removedElement = studentQueue.remove()
  println(removedElement + " : " + studentQueue)
Smoggy Snail

Jawaban yang mirip dengan “Antrian Kotlin”

Pertanyaan yang mirip dengan “Antrian Kotlin”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya