java.lang.Double.doubleValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(300)

本文整理了Java中java.lang.Double.doubleValue()方法的一些代码示例,展示了Double.doubleValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Double.doubleValue()方法的具体详情如下:
包路径:java.lang.Double
类名称:Double
方法名:doubleValue

Double.doubleValue介绍

[英]Gets the primitive value of this double.
[中]获取此double的基元值。

代码示例

代码示例来源:origin: apache/incubator-dubbo

public static double unboxed(Double v) {
  return v == null ? 0 : v.doubleValue();
}

代码示例来源:origin: apache/incubator-dubbo

public static double unboxed(Double v) {
  return v == null ? 0 : v.doubleValue();
}

代码示例来源:origin: google/guava

@Override
 public boolean apply(Double input) {
  return input.doubleValue() > 0.0;
 }
});

代码示例来源:origin: prestodb/presto

@Override
public void serialize(Object value, JsonGenerator gen,
    SerializerProvider provider) throws IOException {
  gen.writeNumber(((Double) value).doubleValue());
}

代码示例来源:origin: redisson/redisson

@Override
public void writeTag(Object data, MBOut out) {
  double d = ((Double) data).doubleValue();
  {
    byte[] bytes = Double.toString(d).getBytes();
    out.writeArray(bytes, 0, bytes.length);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Converts value to <code>double</code>. Returns default value
 * when conversion result is <code>null</code>.
 */
public double toDoubleValue(Object value, double defaultValue) {
  Double result = (Double) typeConverters[9].convert(value);
  if (result == null) {
    return defaultValue;
  }
  return result.doubleValue();
}

代码示例来源:origin: redisson/redisson

/**
 * Converts type using type converter manager.
 */
protected double convertType(Object value) {
  return typeConverterManagerBean.convertType(value, double.class).doubleValue();
}

代码示例来源:origin: spring-projects/spring-framework

public double getDoubleProperty(String name) throws JMSException {
  Object value = this.properties.get(name);
  return (value instanceof Double) ? ((Double) value).doubleValue() : 0;
}

代码示例来源:origin: prestodb/presto

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 */
@Override
public ValueNode numberNode(Double value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: redisson/redisson

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 */
@Override
public ValueNode numberNode(Double value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: apache/incubator-druid

public double getEstimate()
{
 if (cachedEstimate == null) {
  cachedEstimate = getSketch().getEstimate();
 }
 return cachedEstimate.doubleValue();
}

代码示例来源:origin: prestodb/presto

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 *
 * @return This array node, to allow chaining
 */
public ArrayNode add(Double value) {
  if (value == null) {
    return addNull();
  }
  return _add(numberNode(value.doubleValue()));
}

代码示例来源:origin: prestodb/presto

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 *
 * @return This array node, to allow chaining
 */
public ArrayNode insert(int index, Double value) {
  if (value == null) {
    return insertNull(index);
  }
  return _insert(index, numberNode(value.doubleValue()));
}

代码示例来源:origin: prestodb/presto

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 * 
 * @return This node (to allow chaining)
 */
public ObjectNode put(String fieldName, Double v) {
  return _put(fieldName, (v == null) ? nullNode()
      : numberNode(v.doubleValue()));
}

代码示例来源:origin: redisson/redisson

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 * 
 * @return This node (to allow chaining)
 */
public ObjectNode put(String fieldName, Double v) {
  return _put(fieldName, (v == null) ? nullNode()
      : numberNode(v.doubleValue()));
}

代码示例来源:origin: redisson/redisson

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 *
 * @return This array node, to allow chaining
 */
public ArrayNode insert(int index, Double value) {
  if (value == null) {
    return insertNull(index);
  }
  return _insert(index, numberNode(value.doubleValue()));
}

代码示例来源:origin: redisson/redisson

/**
 * Alternative method that we need to avoid bumping into NPE issues
 * with auto-unboxing.
 *
 * @return This array node, to allow chaining
 */
public ArrayNode add(Double value) {
  if (value == null) {
    return addNull();
  }
  return _add(numberNode(value.doubleValue()));
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testCombine()
{
 Assert.assertEquals(3.4d, ((Double) doubleMaxAggFactory.combine(1.2, 3.4)).doubleValue(), 0.0001);
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testCombine()
{
 Assert.assertEquals(1.2d, ((Double) doubleMinAggFactory.combine(1.2, 3.4)).doubleValue(), 0.0001);
}

代码示例来源:origin: google/guava

public void testGetDefaultValue() {
  assertEquals(false, Defaults.defaultValue(boolean.class).booleanValue());
  assertEquals('\0', Defaults.defaultValue(char.class).charValue());
  assertEquals(0, Defaults.defaultValue(byte.class).byteValue());
  assertEquals(0, Defaults.defaultValue(short.class).shortValue());
  assertEquals(0, Defaults.defaultValue(int.class).intValue());
  assertEquals(0, Defaults.defaultValue(long.class).longValue());
  assertEquals(0.0f, Defaults.defaultValue(float.class).floatValue());
  assertEquals(0.0d, Defaults.defaultValue(double.class).doubleValue());
  assertNull(Defaults.defaultValue(void.class));
  assertNull(Defaults.defaultValue(String.class));
 }
}

相关文章