如何解决错误 “无法实例化类型 Triple”

huangapple go评论100阅读模式
英文:

How to solve error ""cannot instantiate the type Triple""

问题

我尝试使用三元组来返回多个值,但出现了“无法实例化类型Triple”的错误。我尝试了多种方法,但都没有成功。正确的语法是什么?

  1. import org.apache.commons.lang3.tuple.Triple;
  2. private static Triple<String, String, String> test() {
  3. Triple<String, String, String> triple = Triple.of(null, null, null);
  4. // ...
  5. return triple;
  6. }
英文:

I'm trying to use a triple to return multiple values but I get "cannot instantiate the type Triple" I tried multiple things but nothing worked. What is the correct Syntax?

  1. import org.apache.commons.lang3.tuple.Triple;
  2. private static Triple&lt;String, String, String&gt; test() {
  3. Triple&lt;String, String, String&gt; triple = new Triple&lt;&gt;();
  4. ...
  5. return triple;
  6. }

答案1

得分: 5

Triple是抽象的,请使用MutableTriple或ImmutableTriple代替。

英文:

Triple is abstract, use MutableTriple or ImmutableTriple instead.

huangapple
  • 本文由 发表于 2020年8月7日 18:04:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/63299555.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定