Triple

Report a typo

Given an immutable class Triple:

final class Triple<L, M, R> {
    private final L left;
    private final M middle;
    private final R right;

    Triple(L left, M middle, R right) {
        this.left = left;
        this.middle = middle;
        this.right = right;
    }
}

Here is a list of integers:

List<Integer> numbers = Arrays.asList(5, 3, 4, 1);

What triples does the set contain?

Set<Triple<Integer, Integer, String>> set = numbers.stream()
        .map(val -> new Triple<>(val, val * val, String.valueOf(val) + String.valueOf(val)))
        .collect(Collectors.toSet());
Select one or more options from the list
___

Create a free account to access the full topic