Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

I want to have a tuple structure with the below Hashtable:

Hashtable<Long, Tuple<Set<Long>,Set<Long>>> table = ...

Can anyone tell me how to do it?

1 Answer

0 votes
by (19.7k points)

Java doesn’t have a separate tuple class. You can implement one like below: 

public class Tuple<X, Y> { 

  public final X x; 

  public final Y y; 

  public Tuple(X x, Y y) { 

    this.x = x; 

    this.y = y; 

  } 

Interested in Java? Check out this Java Certification by Intellipaat.    

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...