简体   繁体   English

如何在Jruby中传递类类型参数

[英]How to pass class type arguments in jruby

Say I need to translate the following Java code in jruby: 说我需要在jruby中翻译以下Java代码:

Map<String, Integer> topicCountMap = new HashMap<String, Integer>();

In jruby, without type arguments it'd look like this: 在jruby中,如果没有类型参数,它将如下所示:

topic_count_map = HashMap.new

But how do I pass type arguments? 但是如何传递类型参数?

You don't. 你不知道 The type arguments are not specified in JRuby JRuby中未指定类型参数

topic_count_map = HashMap.new
topic_count_map.put("foo", 100)
topic_count_map.get("foo")

Read: JRuby Basics 阅读: JRuby基础

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM