Code example for Constructor

Methods: getGenericParameterTypes

0
public class DefConstrMap<K, V> { 
	Map<K,V> map;
	Constructor<V> constr;
 
	public DefConstrMap( Constructor constr ) {
		if( constr.getGenericParameterTypes().length != 0 )
			throw new IllegalArgumentException( "Defaultconstructor expectet" );
		map = new HashMap<K,V>();
		this.constr = constr;
	} 
 
	public DefConstrMap( Constructor constr , Map<K,V> map ) {
		if( constr.getGenericParameterTypes().length != 0 )
			throw new IllegalArgumentException( "Defaultconstructor expectet" );
		this.map = map;
		this.constr = constr;
	} 
 
	public V get( K key ) {
		V value = map.get( key );
Experience pair programming with AI  Get Codota for Java