添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am working through Data Algorithms book and

I am getting the following compilation error when trying to access Tuple2 members in Java:

I admit, that I am newish to Scala but the syntax looks right, per scala-lang so any help is appreciated. Thanks

_1 has private access in scala.Tuple2
_2 has private access in scala.Tuple2

The code snippet in question

List<Tuple2<String, Iterable<Tuple2<Integer,Integer>>>> output2 = groups.collect();
for(Tuple2<String, Iterable<Tuple2<Integer,Integer>>> t : output2){
        Iterable<Tuple2<Integer,Integer>> list = t._2;
        System.out.println(t._1);
        for(Tuple2<Integer,Integer> t2 : list){
                System.out.println(t2._1 + "," + t2._2);
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.