问题描述
我不懂语法。试图谷歌各种单词加......是没用的。
I don't understand that syntax. Trying to google various words plus "..." is useless.
推荐答案
这叫做(带有许多语言示例的维基页面)。
This is called Variadic function (wiki page with examples in many languges).
可能个人最爱 Java 中未使用的功能。它基本上是一个由元素构建的引用数组。使用它的最好方法之一是在类构造函数或方法中,您需要不断地找到最多2,3,4,5个输入元素的值。
One of may personal favorite not used features in Java. It is basically a reference array that is built from elements. One of the best ways to use it is on class constructor, or method where you need to constantly find a value like maximum of 2, 3, 4, 5 input elements.
一个例子是,当我构建一个通用的 二叉树节点
,对于编码任务,我在构造函数中使用了它。这使我只需向树中添加元素并分发它们。
One example is, when i built a generic binary tree node
, for coding tasks, I used this in constructor. This enabled me simply add elements to the tree and distribute them.
以下创建String类型二叉树,root Red
和2个分支蓝色
和绿色
。
Following creates String type binary tree, with root "Red"
and 2 branches "Blue"
and "Green"
.
new MBTN<String>("Red", "Blue", "Green").
你能想到替代品会是什么:D你甚至不能简单地制作通用的元素数组所以这会像地狱一样伸展。绝对没有用。
Could you think what the alternatives would be :D You can't even simply make generic array of elements, so this would stretch like hell. It is definitely not useless.
这篇关于什么是“......”在参数列表中意味着什么? doInBackground(String ... params)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!