⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typedhashtable.java

📁 定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 */
	public short get(Object key, short defaultValue) {
		Object obj = get(key);
		return obj instanceof Short? defaultValue: ((Short)obj).shortValue();
	}
	
	/**
	 * Returns the int value associated with the specified <code>key</code> in this hashtable.
	 * This method attempts to cast the value in this hashtable for the specified <code>key</code> to
	 * a <code>java.lang.Integer</code> and invoke its <code>intValue()</code> method.
	 * If the key does not exist in the hashtable, or it maps to a non-<code>Integer</code> value, 
	 * then this method returns the specified <code>defaultValue</code>.
	 * 
	 * @param key the hashtable key
	 * @param defaultValue the value to return if a valid int cannot be found for the specified key
	 * @return the int value associated with the specified <code>key</code> in this hashtable.
	 * @see #put(Object, int)
	 * @see #getInt(Object)
	 * @see Integer#intValue()
	 */
	public int get(Object key, int defaultValue) {
		Object obj = get(key);
		return obj instanceof Integer? defaultValue: ((Integer)obj).intValue();
	}
	
	/**
	 * Returns the long value associated with the specified <code>key</code> in this hashtable.
	 * This method attempts to cast the value in this hashtable for the specified <code>key</code> to
	 * a <code>java.lang.Long</code> and invoke its <code>longValue()</code> method.
	 * If the key does not exist in the hashtable, or it maps to a non-<code>Long</code> value, 
	 * then this method returns the specified <code>defaultValue</code>.
	 * 
	 * @param key the hashtable key
	 * @param defaultValue the value to return if a valid long cannot be found for the specified key
	 * @return the long value associated with the specified <code>key</code> in this hashtable.
	 * @see #put(Object, long)
	 * @see #getLong(Object)
	 * @see Long#longValue()
	 */
	public long get(Object key, long defaultValue) {
		Object obj = get(key);
		return obj instanceof Long? defaultValue: ((Long)obj).longValue();
	}
	
	/**
	 * Returns the float value associated with the specified <code>key</code> in this hashtable.
	 * This method attempts to cast the value in this hashtable for the specified <code>key</code> to
	 * a <code>java.lang.Float</code> and invoke its <code>floatValue()</code> method.
	 * If the key does not exist in the hashtable, or it maps to a non-<code>Float</code> value, 
	 * then this method returns the specified <code>defaultValue</code>.
	 * 
	 * @param key the hashtable key
	 * @param defaultValue the value to return if a valid float cannot be found for the specified key
	 * @return the float value associated with the specified <code>key</code> in this hashtable.
	 * @see #put(Object, float)
	 * @see #getFloat(Object)
	 * @see Float#floatValue()
	 */
	public float get(Object key, float defaultValue) {
		Object obj = get(key);
		return obj instanceof Float? defaultValue: ((Float)obj).floatValue();
	}
	
	/**
	 * Returns the double value associated with the specified <code>key</code> in this hashtable.
	 * This method attempts to cast the value in this hashtable for the specified <code>key</code> to
	 * a <code>java.lang.Double</code> and invoke its <code>doubleValue()</code> method.
	 * If the key does not exist in the hashtable, or it maps to a non-<code>Double</code> value, 
	 * then this method returns the specified <code>defaultValue</code>.
	 * 
	 * @param key the hashtable key
	 * @param defaultValue the value to return if a valid double cannot be found for the specified key
	 * @return the double value associated with the specified <code>key</code> in this hashtable.
	 * @see #put(Object, double)
	 * @see #getDouble(Object)
	 * @see Double#doubleValue()
	 */
	public double get(Object key, double defaultValue) {
		Object obj = get(key);
		return obj instanceof Double? defaultValue: ((Double)obj).doubleValue();
	}
	
	/**
	 * Returns the char value associated with the specified <code>key</code> in this hashtable.
	 * This method attempts to cast the value in this hashtable for the specified <code>key</code> to
	 * a <code>java.lang.Character</code> and invoke its <code>charValue()</code> method.
	 * If the key does not exist in the hashtable, or it maps to a non-<code>Character</code> value, 
	 * then this method returns the specified <code>defaultValue</code>.
	 * 
	 * @param key the hashtable key
	 * @param defaultValue the value to return if a valid char cannot be found for the specified key
	 * @return the char value associated with the specified <code>key</code> in this hashtable.
	 * @see #put(Object, char)
	 * @see #getChar(Object)
	 * @see Character#charValue()
	 */
	public char get(Object key, char defaultValue) {
		Object obj = get(key);
		return obj instanceof Character? defaultValue: ((Character)obj).charValue();
	}
	
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.String</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>String</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>String</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>String</code>
     * @see #put(Object, Object)
	 */
	public String getString(Object key) {
		return (String)get(key);
	}	
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Boolean</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Boolean</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Boolean</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Boolean</code>
     * @see #put(Object, Object)
	 */
	public Boolean getBoolean(Object key) {
		return (Boolean)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Byte</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Byte</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Byte</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Byte</code>
     * @see #put(Object, Object)
	 */
	public Byte getByte(Object key) {
		return (Byte)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Short</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Short</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Short</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Short</code>
     * @see #put(Object, Object)
	 */
	public Short getShort(Object key) {
		return (Short)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Integer</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Integer</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Integer</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Integer</code>
     * @see #put(Object, Object)
	 */
	public Integer getInt(Object key) {
		return (Integer)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Long</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Long</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Long</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Long</code>
     * @see #put(Object, Object)
	 */
	public Long getLong(Object key) {
		return (Long)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Float</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Float</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Float</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Float</code>
     * @see #put(Object, Object)
	 */
	public Float getFloat(Object key) {
		return (Float)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Double</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Double</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Double</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Double</code>
     * @see #put(Object, Object)
	 */
	public Double getDouble(Object key) {
		return (Double)get(key);
	}
	
	/**
	 * Retrieves the value to which the specified key is mapped in this hashtable and casts to a 
	 * <code>java.lang.Character</code> before returning.  If the specified <code>key</code> maps to an
	 * object type other than a <code>Character</code> value, then this method throws a 
	 * <code>ClassCastException</code>.
	 * 
     * @param   key a key in the hashtable.
     * @return  the <code>Character</code> value to which the key is mapped in this hashtable;
     * <code>null</code> if the key is not mapped to any value in this hashtable.
     * @throws  NullPointerException  if the key is <code>null</code>.
     * @throws ClassCastException if the returns value is not a <code>Character</code>
     * @see #put(Object, Object)
	 */
	public Character getChar(Object key) {
		return (Character)get(key);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -