Java tutorial
//package com.java2s; import java.util.LinkedHashSet; import java.util.Set; public class Main { public static <V> Set<V> newLinkedHashSet(int expectedSize) { return new LinkedHashSet<V>(expectedSizeToCapacity(expectedSize)); } private static int expectedSizeToCapacity(int expectedSize) { return 4 * expectedSize / 3 + 1; } }