FileDocCategorySizeDatePackage
LinkedHashCollectionHelper.javaAPI DocHibernate 3.2.52592Mon Jul 10 11:31:10 BST 2006org.hibernate.util

LinkedHashCollectionHelper

public final class LinkedHashCollectionHelper extends Object

Fields Summary
private static final Class
SET_CLASS
private static final Class
MAP_CLASS
private static final Class[]
CAPACITY_CTOR_SIG
private static final Constructor
SET_CAPACITY_CTOR
private static final Constructor
MAP_CAPACITY_CTOR
private static final float
LOAD_FACTOR_V
private static final Float
LOAD_FACTOR
Constructors Summary
private LinkedHashCollectionHelper()

Methods Summary
public static java.util.MapcreateLinkedHashMap()

		try {
			return (Map) MAP_CLASS.newInstance();
		}
		catch (Exception e) {
			throw new AssertionFailure("Could not instantiate LinkedHashMap", e);
		}
	
public static java.util.MapcreateLinkedHashMap(int anticipatedSize)

		if ( anticipatedSize <= 0 ) {
			return createLinkedHashMap();
		}
		int initialCapacity = anticipatedSize + (int)( anticipatedSize * LOAD_FACTOR_V );
		try {
			return ( Map ) MAP_CAPACITY_CTOR.newInstance( new Object[] { new Integer( initialCapacity ), LOAD_FACTOR } );
		}
		catch (Exception e) {
			throw new AssertionFailure("Could not instantiate LinkedHashMap", e);
		}
	
public static java.util.SetcreateLinkedHashSet()


	 
		Class setClass;
		Class mapClass;
		Constructor setCtor;
		Constructor mapCtor;
		try {
			setClass = Class.forName( "java.util.LinkedHashSet" );
			mapClass = Class.forName( "java.util.LinkedHashMap" );
			setCtor = setClass.getConstructor( CAPACITY_CTOR_SIG );
			mapCtor = mapClass.getConstructor( CAPACITY_CTOR_SIG );
		}
		catch ( Throwable t ) {
			setClass = null;
			mapClass = null;
			setCtor = null;
			mapCtor = null;
		}
		SET_CLASS = setClass;
		MAP_CLASS = mapClass;
		SET_CAPACITY_CTOR = setCtor;
		MAP_CAPACITY_CTOR = mapCtor;
	
		try {
			return (Set) SET_CLASS.newInstance();
		}
		catch (Exception e) {
			throw new AssertionFailure("Could not instantiate LinkedHashSet", e);
		}
	
public static java.util.SetcreateLinkedHashSet(int anticipatedSize)

		if ( anticipatedSize <= 0 ) {
			return createLinkedHashSet();
		}
		int initialCapacity = anticipatedSize + (int)( anticipatedSize * LOAD_FACTOR_V );
		try {
			return ( Set ) SET_CAPACITY_CTOR.newInstance( new Object[] { new Integer( initialCapacity ), LOAD_FACTOR  } );
		}
		catch (Exception e) {
			throw new AssertionFailure("Could not instantiate LinkedHashSet", e);
		}