The availability of libraries of container classes has significant benefits for programmer productivity, and containers such as java.util.Hashtable and java.util.Vector are used by most Java programs. The implementations of these containers are typically tuned for some average usage pattern. If the use of a container in a specific application does not match this average pattern, performance may be suboptimal. We present an approach in which applications are rewritten to use customized versions of container classes that are automatically generated using a combination of static analysis and profile information. We evaluated this approach on a small set of Java applications, and measured speedups of up to 18%.