Java Object to Double asDouble(Object val, Double def)

Here you can find the source of asDouble(Object val, Double def)

Description

as Double

License

LGPL

Declaration

public static Double asDouble(Object val, Double def) 

Method Source Code

//package com.java2s;

public class Main {
    public static Double asDouble(Object val) {
        return asDouble(val, null);
    }/*from  www  .j  av  a  2 s.  c om*/

    public static Double asDouble(Object val, Double def) {
        Double ret = null;
        try {
            ret = Double.valueOf(val.toString());
        } catch (Exception e) {
            ret = def;
        }
        return ret;
    }
}

Related

  1. asDouble(final Object o)
  2. asDouble(final Object object)
  3. asDouble(Object o)
  4. asDouble(Object obj)
  5. asDouble(Object value)
  6. asDouble(Object value)
  7. asDouble(Object value)
  8. castDouble(Object o)