在Java中什么是< >符号 [英] In Java What is the < > notation

查看:826
本文介绍了在Java中什么是< >符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Map<?,?>在Java中意味着什么?

Java泛型 - 这是什么语法?

我想知道符号< > 例如在Java中。

I was wondering what does the notation < > does in Java, for example.

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

我不是任何时尚的java专家。我希望你能提供一些明确的答案,说明使用< > 表示法。

I am not a java expert in any fashion. I hope you can provide some clear answer for the reasons behind using the < > notation.

推荐答案

它表示泛型。 Mapper 是一个泛型,您继承自 Mapper< LongWritable,Text,Text,IntWritable> ,这就是

It denotes generics. Mapper is a generic and you're inheriting from Mapper<LongWritable, Text, Text, IntWritable>, which is that generic specialized for those types.

它就像 Vector - 也是一个泛型 - 您可以使用 Vector< Object> Vector< SomeOtherClass>

It's like Vector - also a generic - you can have Vector<Object> and Vector<SomeOtherClass>.

这篇关于在Java中什么是&lt; &GT;符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆