Scala Program to Check a Queue Contains a Specified Item

Scala Program to Check a Queue Contains a Specified Item

Scala program to check a queue contains a specified item

// Scala program to check a queue contains 
// a specified item

import scala.collection.mutable._

object Sample {
  // Main method
  def main(args: Array[String]) {
    var queue = Queue(10, 20, 30, 40, 50);

    if (queue.contains(30))
      println("queue contains item 30");
    else
      println("queue does not contain item 30");
  }
}

output

queue contains item 30
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment