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,910 points
639 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,910 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
875 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,068 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,588 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,390 points
28,772 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,910 points
350 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,910 points
589 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,910 points
830 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,910 points
476 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,910 points
546 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,910 points
2,737 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