Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8539189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:18:18+00:00 2026-06-11T11:18:18+00:00

Here is the class definition in java code: public class WordCount { public static

  • 0

Here is the class definition in java code:

public class WordCount {

 public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> {
    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();

    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        StringTokenizer tokenizer = new StringTokenizer(line);
        while (tokenizer.hasMoreTokens()) {
            word.set(tokenizer.nextToken());
            context.write(word, one);
        }
    }
 } 

So what does this mean?

public static class Map extends Mapper<LongWritable, Text, Text, IntWritable>

Why we need a “<>” here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:18:19+00:00Added an answer on June 11, 2026 at 11:18 am

    This is called “generics”. It allows you to add type parameters.

    In this particular case, it means that Map is a Mapper for tuples of (LongWritable,Text,Text,IntWritable).

    A simpler example: suppose you have a Set. It could be a Set of integers, a set of strings, of MyClass instances…. this is where you use generics.
    By declaring that a variable is of type Set<Integer>, you specify that it is a set of Integers. If you’d just declare it as a Set, you would have to check that it only contained Integers yourself. By adding the type parameter <Integer>, the compiler can now do the type-checking.

    Generics are defined here in the Java Language Specification.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this code here class Usable; class Usable_lock { friend class Usable; private:
I have a few classes as shown here public class TrueFalseQuestion implements Question{ static{
The Class definition private class classSerial implements Serializable { private static final long serialVersionUID
I have a template class, called OneCell , here the definition: template <class T>
I have a template class, called Cell , here the definition: template <class T>
Given the code from here : class lazy_init { mutable std::once_flag flag; mutable std::unique_ptr<expensive_data>
I have a fairly straightforward Java class here which creates 2 thread pools.... Connects
Here is my class (product.cs) where is the method to insert the image: public
I am reading Thinking in java 4th edition and I encountered this code class
I have DTO which contains itself (it is nested). public class MyDTO { private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.