How to use scala Map size method

0 votes
How to use scala Map size() method?
Nov 17, 2020 in Big Data Hadoop by anonymous
• 8,870 points
891 views

1 answer to this question.

0 votes

The size() is utilized to find the number of key-value pairs in the stated map.

Method Definition: def size: Int

Return Type: It returns the number of elements in the map.

// Scala program of size()

// method

  

// Creating object

object GfG

{ 

  

    // Main method

    def main(args:Array[String])

    {

      

        // Creating a map

        val m1 = Map(3 -> "geeta", 1 -> "for", 2 -> "cs")

          

        // Applying size method

        val result = m1.size

          

        // Displays output

        println(result)

      

    }

}
answered Nov 17, 2020 by Gitika
• 65,770 points

Related Questions In Big Data Hadoop

0 votes
1 answer

How to use custom FileInputFormat in MapReduce?

You have to override isSplitable method. ...READ MORE

answered Apr 10, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,247 views
0 votes
1 answer

How can I use my host machine’s web browser to check my HDFS services running in the VM?

The sole purpose of the virtual machine ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,462 views
0 votes
1 answer

How to set the number of Map & Reduce tasks?

The map tasks created for a job ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,944 views
0 votes
1 answer

How to groupBy/count then filter on count in Scala

I think the exception is caused because ...READ MORE

answered Apr 19, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
29,765 views
0 votes
1 answer

How to start working with scala?

Scala can be installed on any UNIX ...READ MORE

answered Nov 16, 2020 in Big Data Hadoop by Gitika
• 65,770 points
609 views
0 votes
1 answer

How to execute scala programming?

We can execute a Scala program in ...READ MORE

answered Nov 16, 2020 in Big Data Hadoop by Gitika
• 65,770 points
791 views
0 votes
1 answer

How to write a Scala program in script mode?

Open notepad and add the following code ...READ MORE

answered Nov 16, 2020 in Big Data Hadoop by Gitika
• 65,770 points
1,127 views
0 votes
1 answer

How to import scala packages?

Scala packages can be imported so that ...READ MORE

answered Nov 16, 2020 in Big Data Hadoop by Gitika
• 65,770 points
664 views
0 votes
1 answer

How to use scala map as mutable map?

By default, Scala uses an immutable Map. ...READ MORE

answered Nov 17, 2020 in Big Data Hadoop by Gitika
• 65,770 points
815 views
0 votes
1 answer

How to use Hbase shell in a bash script?

Hello, To write scripts with HBase shell it includes non-interactive mode, ...READ MORE

answered May 29, 2019 in Big Data Hadoop by Gitika
• 65,770 points
3,070 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP