Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { /** * Create a new {@link HashSet} from an existing set and another element. * * @param existing * @param element * @return */ public static <T> HashSet<T> joinToHashSet(Set<T> existing, T element) { final HashSet<T> visitedWithNewPoint = new HashSet<T>(existing); visitedWithNewPoint.add(element); return visitedWithNewPoint; } }