Methods Summary |
---|
public static java.util.Map | createLinkedHashMap()
try {
return (Map) MAP_CLASS.newInstance();
}
catch (Exception e) {
throw new AssertionFailure("Could not instantiate LinkedHashMap", e);
}
|
public static java.util.Map | createLinkedHashMap(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.Set | createLinkedHashSet()
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.Set | createLinkedHashSet(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);
}
|