Java Object to Double asDouble(Object value)

Here you can find the source of asDouble(Object value)

Description

as Double

License

Open Source License

Declaration

public static double asDouble(Object value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double asDouble(Object value) {
        if (value instanceof Double) {
            return ((Double) value).doubleValue();
        }//from   w  ww  .j a va2 s.co m
        throw new IllegalArgumentException("not a number");
    }

    public static double asDouble(Object value, double def) {
        if (value instanceof Double) {
            return ((Double) value).doubleValue();
        }
        return def;
    }
}

Related

  1. asDouble(final Object o)
  2. asDouble(final Object object)
  3. asDouble(Object o)
  4. asDouble(Object obj)
  5. asDouble(Object val, Double def)
  6. asDouble(Object value)
  7. asDouble(Object value)
  8. castDouble(Object o)
  9. castDoubleToFloat(final double v)