Reputation: 9
How can I return two individual iterated Set<String>
values in a same method to a Future
object which is in main method? I'm using Callable
since I have to return a set of string values and store them for furthur use.
Upvotes: 1
Views: 109
Reputation: 116918
If I understand the question, it would be the same when you want to return multiple values from any method. You can always create a wrapper class that holds any number of Set
values and return that from your Callable
.
private static class MultiSet {
Set<Integer> set1;
Set<Integer> set2;
}
private static class MyCallable implements Callable<MultiSet> {
public MultiSet call() {
...
}
}
Upvotes: 1