class CollectionUtils {

	public static <T> Collection<Tuple2<T, T>> crossProduct(List<T> list) {
		Builder<Tuple2<T, T>> result = ImmutableList.builder();
		int size = list.size();
		for (int i = 0; i < size; i++) {
			T left = list.get(i);
			Iterable<T> remaining = list.subList(i, size);
			Seq.of(left)
				.crossJoin(remaining)
				.forEach(result::add);
		}
		return result.build();
	}

}