{"id":9702,"date":"2022-01-18T07:20:06","date_gmt":"2022-01-18T07:20:06","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=9702"},"modified":"2024-04-11T07:58:33","modified_gmt":"2024-04-11T07:58:33","slug":"scala-sequences-and-vector","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/","title":{"rendered":"SCALA- SEQUENCES AND VECTOR"},"content":{"rendered":"<h2><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Benefits of Using Vector in Scala&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:6145,&quot;3&quot;:{&quot;1&quot;:0,&quot;3&quot;:1},&quot;14&quot;:{&quot;1&quot;:3,&quot;3&quot;:1},&quot;15&quot;:&quot;Arial&quot;}\">Benefits of Using Vector in Scala<\/span><\/h2>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Sequence<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">A sequence is implemented by list(list is immutable)<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">Sequence support mutability and immutability.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><b><span data-contrast=\"auto\">Note:<\/span><\/b><span data-contrast=\"auto\"> When pass mutability package: <\/span><b><span data-contrast=\"auto\">import scala.collection.mutable.seq\u00a0 .<\/span><\/b><span data-contrast=\"auto\">It return array Buffer.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class SequenceExampl {\u00a0\r\n\r\n\u00a0 val seq1 = Seq(3,4,5,6,7)\u00a0\r\n\r\n\u00a0 println(seq1)\u00a0\r\n\r\n}\u00a0\r\n\r\nobject Seq1{\u00a0\r\n\r\n\u00a0 def main(args:Array[String]):Unit={\u00a0\r\n\r\n\u00a0\u00a0\u00a0 new SequenceExampl()\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h4><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">List(3, 4, 5, 6, 7)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The list follows FIFO.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class SequenceExampl {\u00a0\r\n\r\n\u00a0 val seq1 = Seq(3,4,5,6,7)\u00a0\r\n\r\n\u00a0 println(seq1)\u00a0\r\n\r\n\u00a0 def checkElements() ={\u00a0\r\n\r\n\u00a0\u00a0\u00a0 seq1.foreach(ele =&gt;println(\"Access of elements :\" +ele))\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(seq1(4))\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}\u00a0\r\n\r\nobject Seq1 {\u00a0\r\n\r\n\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 new SequenceExampl().checkElements()\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">List(3, 4, 5, 6, 7)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">7<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import scala.collection.mutable.Seq\u00a0\r\n\r\nclass SequenceExampl {\u00a0\r\n\r\n\u00a0 val seq1 = Seq(3,4,5,6,7)\u00a0\r\n\r\n\u00a0 seq1(3) = 60\u00a0\r\n\r\n\u00a0\r\n\r\n\u00a0 println(seq1)\u00a0\r\n\r\n\u00a0 def checkElements() ={\u00a0\r\n\r\n\u00a0\u00a0\u00a0 seq1.foreach(ele =&gt;println(\"Access of elements :\" +ele))\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(seq1(4))\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}\u00a0\r\n\r\nobject Seq1 {\u00a0\r\n\r\n\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 new SequenceExampl().checkElements()\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">ArrayBuffer(3, 4, 5, 60, 7)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">7\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Vector:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Vector is good for large elements.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Vector is by default immutable.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n\u00a0 object VecE{\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args:Array[String]):Unit={\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0 }<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Vector(23, 24, 25, 26, 27, 28, 29, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Explanation:<\/span><\/b><span data-contrast=\"auto\"> Vector return vector. It is immutable.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Question:<\/span><\/b><span data-contrast=\"auto\"> Can we access the index value?<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n\u00a0 println(\"return the index value 4 :\" +ve(4))\u00a0\r\n\r\n\u00a0 println(\"return the index value 5 :\" +ve(5))\u00a0\r\n\r\n\u00a0 println(\"return the index value 6 :\" +ve(6))\u00a0\r\n\r\n\u00a0 println(\"return the index value 7 :\" +ve(7))\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE{\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args:Array[String]):Unit={\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0 }<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Vector(23, 24, 25, 26, 27, 28, 29, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example :<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 ve(4) =33\u00a0\r\n\r\n\u00a0\u00a0 println(ve)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve(4))\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE{\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args:Array[String]):Unit={\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0}<\/pre>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">value update is not a member of scala.collection.immutable.Vector[Int]<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">did you mean updated?<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0\u00a0\u00a0 ve(4) =33<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve1 = ve:+(3,4)\u00a0\r\n\r\n\u00a0 val ve2 = ve++ve1\u00a0\r\n\r\n\u00a0 def ve_fun()= {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Size of ve2 :\" + ve2.size)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"First values of ve2 :\" + ve2.head)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Reverse elements of ve2 : \" +ve2.reverse)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 \/\/ println(\"Sorted(ASC) order : \" + ve2.sorted)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 \/\/reverse is not working as ve2 elements (3,4) it's not a separate elements it's single elements and during running its not getting understand so throw error\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample().ve_fun()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0 }<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Vector(23, 24, 25, 26, 27, 28, 29, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Size of ve2 :17<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">First values of ve2 :23<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Reverse elements of ve2 : Vector((3,4), 30, 29, 28, 27, 26, 25, 24, 23, 30, 29, 28, 27, 26, 25, 24, 23)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve1 = ve:+(3,4)\u00a0\r\n\r\n\u00a0 val ve2 = ve++ve1\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"values of value ve2 :\" +ve2)\u00a0\r\n\r\n\u00a0 def ve_fun()= {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Size of ve2 :\" + ve2.size)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"First values of ve2 :\" + ve2.head)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Reverse elements of ve2 : \" +ve2.reverse)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 \/\/println(\"Sorted(ASC) order : \" + ve2.sorted)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample().ve_fun()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0 }<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">values of value ve2 :Vector(23, 24, 25, 26, 27, 28, 29, 30, 23, 24, 25, 26, 27, 28, 29, 30, (3,4))<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Vector(23, 24, 25, 26, 27, 28, 29, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Size of ve2 :17<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">First values of ve2 :23<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Reverse elements of ve2 : Vector((3,4), 30, 29, 28, 27, 26, 25, 24, 23, 30, 29, 28, 27, 26, 25, 24, 23)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:<\/span><\/b><span data-contrast=\"none\">\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve1 = ve:+(3,4)\u00a0\r\n\r\n\u00a0 val ve2 = ve++ve1\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"values of value ve2 :\" +ve2)\u00a0\r\n\r\n\u00a0 def ve_fun()= {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Size of ve2 :\" + ve2.size)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"First values of ve2 :\" + ve2.head)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Reverse elements of ve2 : \" +ve2.reverse)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Sorted(ASC) order : \" + ve2.sorted)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample().ve_fun()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0 }<\/pre>\n<p>&nbsp;<\/p>\n<h4><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><b><span data-contrast=\"auto\">Error:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">No implicit Ordering is defined for Any.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0\u00a0\u00a0 println(&#8220;Sorted(ASC) order: &#8221; + ve2.sorted)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Important point:<\/span><\/b><span data-contrast=\"auto\"> Index = length -1\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Index always start from 0 to &#8230;<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">values of value ve2 :Vector(23, 24, 25, 26, 27, 28, 29, 30, 23, 24, 25, 26, 27, 28, 29, 30, (3,4))<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">sorted is not working here because sorted it not able to read out last element (3,4)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Solution how it can work the below program are given below\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class VectorExample {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve = Vector(23,24,25,26,27,28,29,30)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val ve1 = ve:+3\u00a0\r\n\r\n\u00a0 val ve2 = ve++ve1\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"values of value ve2 :\" +ve2)\u00a0\r\n\r\n\u00a0 def ve_fun()= {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Size of ve2 :\" + ve2.size)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"First values of ve2 :\" + ve2.head)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Reverse elements of ve2 : \" +ve2.reverse)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"Sorted(ASC) order : \" + ve2.sorted)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(ve)\u00a0\r\n\r\n}\u00a0\r\n\r\n\u00a0 object VecE {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 def main(args: Array[String]): Unit = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new VectorExample().ve_fun()\u00a0\r\n\r\n\u00a0\u00a0\u00a0 }\u00a0\r\n\r\n\u00a0}<\/pre>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">values of value ve2 :Vector(23, 24, 25, 26, 27, 28, 29, 30, 23, 24, 25, 26, 27, 28, 29, 30, 3)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Vector(23, 24, 25, 26, 27, 28, 29, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Size of ve2 :17<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">First values of ve2 :23<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Reverse elements of ve2 : Vector(3, 30, 29, 28, 27, 26, 25, 24, 23, 30, 29, 28, 27, 26, 25, 24, 23)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Sorted(ASC) order : Vector(3, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Explanation<\/span><\/b><b><span data-contrast=\"auto\">:<\/span><\/b><span data-contrast=\"auto\"> we can see that the sorted work.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Queue:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When we talk about data management FIFO (first in first out) and LIFO (last in last out) is important.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">FIFO: queue\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">LIFO: stack\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">queue by default FIFO and it&#8217;s immutable.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0It is immutable as well as mutable. But by default it is immutable. Using the queue, we have to import a package of <\/span><b><span data-contrast=\"auto\">import scala.collection.immutable.Queue<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import scala.collection.immutable.Queue\u00a0\r\n\r\nobject QueueExample {\u00a0\r\n\r\n\u00a0 def main(args: Array[String]) = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val queue = Queue(23, 4, 5, 6, 7, 8, 8)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"value of queue : \" + queue)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"first element of queue :\" + queue(1))\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">value of queue : Queue(23, 4, 5, 6, 7, 8, 8)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">first element of queue :4<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><b><span data-contrast=\"auto\">There are two methods to call queue\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">dequeue method\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">enqueue\u00a0 method<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">\u00a0dequeue method: to delete the elements\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">enqueue method: it is for addition of elements\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">How dequeue work:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">It follows FIFO order\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">suppose :(23, 4, 5, 6, 7, 8, 8)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">After dequeue: (23, Queue(4, 5, 6, 7, 8, 8))<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Again applying dequeue :(4, Queue(5, 6, 7, 8,8))<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example<\/span><\/b><span data-contrast=\"auto\">:\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import scala.collection.immutable.Queue\u00a0\r\n\r\nobject QueueExample {\u00a0\r\n\r\n\u00a0 def main(args: Array[String]) = {\u00a0\r\n\r\n\u00a0\u00a0\u00a0 var queue = Queue(23, 4, 5, 6, 7, 8, 8)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"value of queue : \" + queue)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"first element of queue :\" + queue(1))\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val que1 = queue.enqueue(4)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 que1.foreach(ele =&gt; println(\"After enqueue : \" + ele)) \/\/print for que1\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val que2 = queue.dequeue\u00a0\u00a0\u00a0 \/\/It's an inside object so does not need to create instantiate\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"After dequeue : \" + que2)\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">value of queue : Queue(23, 4, 5, 6, 7, 8, 8)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">first element of queue :4<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Stream:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">&#8220;streaming&#8221; means something is moving.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">means its ongoing business. It\u2019s not historical that somebody is a store there. it&#8217;s just like a water<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">stream is a new concept in Scala it is not anywhere in java or python.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">to work with a stream, we need to know the concept of laziness.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">stream collection is implemented with lazy.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">suppose in scala val a = 1 to 10\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">when we assign a is val then it occupies the RAM. Out of RAM, some space is occupied by variables. at one point in time, RAM gets full and it&#8217;s not managing well throwing an exception. It\u2019s a wide issue since computer designed a computer. Then we have to know the algorithm.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">lazy concept:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">lazy is a keyword it only works with val .<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">#lazy val x = 1 to 1000<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">it does not take any memory.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">suppose before assignment of lazy it takes some space 8GB RAM\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">after assignment does not take any space so it 0% utilization of CPU.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">streaming is work like lazy<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Question: What is the difference between function and method?<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Answer:\u00a0 Method is the system has defined for you.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">function means that we create\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">object StreamExample {\u00a0\r\n\r\n\u00a0 def main(args:Array[String])={\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val str = (1 to 20 ).toStream\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(str)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(str(5))\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Stream(1, &lt;not computed&gt;)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">6<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Why streaming<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Why streaming<\/span><b><span data-contrast=\"auto\"> is called<\/span><\/b><span data-contrast=\"auto\"> because control is in our hands. Because when we watch videos on Netflix, Amazon. Which video we want to buffer your memory will work based on that or your charges will start based on that if it&#8217;s not a monthly subscription.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">So, streaming means always real-time whenever we say anything is streaming we will deal real-time data with a streaming business we cannot say 100% real-time because nothing is a hundred % we can say 80% real-time data.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">How to create random values\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Suppose we have random values. it always works with range.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">when we want to use random values we have to use the below syntax<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">val str = 10 #:: 20 #:: 25 #:: Stream.empty<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">object StreamExample {\u00a0\r\n\r\n\u00a0 def main(args:Array[String])={\u00a0\r\n\r\n\u00a0\u00a0\u00a0 val str = 10 #:: 20 #:: 25 #:: Stream.empty\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(str)\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Stream(10, &lt;not computed&gt;)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">tuple:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">tuple support immutable\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">tuple is a mixed element<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">Tuple does not have any name. As array has a name ar.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">It does not support the index.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">then how we can access the elements.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">using <\/span><b><span data-contrast=\"auto\">(._1)<\/span><\/b><span data-contrast=\"auto\"> .it will access the first element.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">if we want to access all the elements one by one there is a function called <\/span><b><span data-contrast=\"auto\">.productIterator<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Example:\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"> Benefits of Using Vector in Scala<\/span><\/p>\n<p><span data-contrast=\"none\">package <\/span><span data-contrast=\"none\">Collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">object <\/span><span data-contrast=\"none\">TupleExample {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">\u00a0 <\/span><span data-contrast=\"none\">def <\/span><span data-contrast=\"none\">main<\/span><span data-contrast=\"none\">(args: Array[<\/span><span data-contrast=\"none\">String<\/span><span data-contrast=\"none\">]): <\/span><span data-contrast=\"none\">Unit <\/span><span data-contrast=\"none\">= {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240,&quot;469777462&quot;:[916,1832,2748,3664,4580,5496,6412,7328,8244,9160,10076,10992,11908,12824,13740,14656],&quot;469777927&quot;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&quot;469777928&quot;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">\u00a0\u00a0\u00a0 \u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">val tup = (1, 1, \"hey\", 1.9, 20)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"all are the tuple elements :\" + tup)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 println(\"first element of the tuple :\" +tup._1)\u00a0\r\n\r\n\u00a0\u00a0\u00a0 tup.productIterator.foreach(println) \/\/ .productIterator method to use to access one by one elements\u00a0\r\n\r\n\u00a0 }\u00a0\r\n\r\n}<\/pre>\n<p><span data-contrast=\"none\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Output:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"> Benefits of Using Vector in Scala<\/span><\/p>\n<p><span data-contrast=\"auto\">all are the tuple elements :(1,1,hey,1.9,20)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">first element of the tuple :1<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">1<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">1<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">hey<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">1.9<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">20<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Process finished with exit code 0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Note:\u00a0\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">try <\/span><\/b><span data-contrast=\"auto\">and <\/span><b><span data-contrast=\"auto\">exception try<\/span><\/b><span data-contrast=\"auto\"> and <\/span><b><span data-contrast=\"auto\">catch <a href=\"https:\/\/prwatech.in\/blog\/\">block<\/a> <\/span><\/b><span data-contrast=\"auto\">these are important for any programming language because when writing a <a href=\"https:\/\/www.tableau.com\/\">code<\/a> in production to write using try and catch method. <\/span><b><span data-contrast=\"auto\">spark is not a language it&#8217;s an API<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"> Benefits of Using Vector in Scala<\/span><\/p>\n<p><b><span data-contrast=\"auto\">\u00a0\u00a0<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Benefits of Using Vector in Scala &nbsp; Sequence\u00a0 A sequence is implemented by list(list is immutable)\u00a0 Sequence support mutability and immutability.\u00a0 Note: When pass mutability package: import scala.collection.mutable.seq\u00a0 .It return array Buffer.\u00a0 package Collection\u00a0 \u00a0 &nbsp; class SequenceExampl {\u00a0 \u00a0 val seq1 = Seq(3,4,5,6,7)\u00a0 \u00a0 println(seq1)\u00a0 }\u00a0 object Seq1{\u00a0 \u00a0 def main(args:Array[String]):Unit={\u00a0 \u00a0\u00a0\u00a0 new SequenceExampl()\u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[565,1698],"tags":[560,1972,1971,1970,1969,1975,576,1974,1973],"class_list":["post-9702","post","type-post","status-publish","format-standard","hentry","category-scala","category-scala-modules-scala","tag-a-scala-tutorial","tag-array","tag-linear-collections-in-scala-seq","tag-list","tag-performance-comparison-between-immutable-seq","tag-range","tag-scala","tag-set","tag-vector"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Benefits of Using Vector in Scala - Prwatech<\/title>\n<meta name=\"description\" content=\"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Benefits of Using Vector in Scala - Prwatech\" \/>\n<meta property=\"og:description\" content=\"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-18T07:20:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-11T07:58:33+00:00\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/\",\"url\":\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/\",\"name\":\"Benefits of Using Vector in Scala - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"datePublished\":\"2022-01-18T07:20:06+00:00\",\"dateModified\":\"2024-04-11T07:58:33+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SCALA- SEQUENCES AND VECTOR\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Benefits of Using Vector in Scala - Prwatech","description":"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Benefits of Using Vector in Scala - Prwatech","og_description":"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.","og_url":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2022-01-18T07:20:06+00:00","article_modified_time":"2024-04-11T07:58:33+00:00","author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/","url":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/","name":"Benefits of Using Vector in Scala - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"datePublished":"2022-01-18T07:20:06+00:00","dateModified":"2024-04-11T07:58:33+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Master Benefits of Using Vector in Scala - Dive deep with our expert instructors and comprehensive curriculum.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/scala\/scala-modules-scala\/scala-sequences-and-vector\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"SCALA- SEQUENCES AND VECTOR"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=9702"}],"version-history":[{"count":6,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9702\/revisions"}],"predecessor-version":[{"id":11347,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9702\/revisions\/11347"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=9702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=9702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=9702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}