Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static Set setWith(Object anElement) { Set asSet = new HashSet(); asSet.add(anElement); return asSet; } public static Set setWith(Object anElement, Object anotherElement) { Set asSet = setWith(anElement); asSet.add(anotherElement); return asSet; } public static Set setWith(Object firstElement, Object secondElement, Object thirdElement) { Set set = setWith(firstElement, secondElement); set.add(thirdElement); return set; } }