@Test public void testFloatPromotion() throws Exception { BdfList list = new BdfList(); list.add(1F); list.add(2D); assertEquals(Double.valueOf(1), list.getDouble(0)); assertEquals(Double.valueOf(2), list.getDouble(1)); }
public Double getDouble(int index) throws FormatException { if (!isInRange(index)) throw new FormatException(); Object o = get(index); if (o instanceof Double) return (Double) o; if (o instanceof Float) return ((Float) o).doubleValue(); throw new FormatException(); }
BdfList extends ArrayList<Object> { public Double getDouble(int index) throws FormatException { if (!isInRange(index)) throw new FormatException(); Object o = get(index); if (o instanceof Double) return (Double) o; if (o instanceof Float) return ((Float) o).doubleValue(); throw new FormatException(); } }
BdfList extends ArrayList<Object> { public Double getDouble(int index) throws FormatException { if (!isInRange(index)) throw new FormatException(); Object o = get(index); if (o instanceof Double) return (Double) o; if (o instanceof Float) return ((Float) o).doubleValue(); throw new FormatException(); } BdfList();  BdfList(List<Object> items); }
BdfList extends ArrayList<Object> { public Double getDouble(int index) throws FormatException { if (!isInRange(index)) throw new FormatException(); Object o = get(index); if (o instanceof Double) return (Double) o; if (o instanceof Float) return ((Float) o).doubleValue(); throw new FormatException(); } BdfList();  BdfList(List<Object> items); static BdfList of(Object... items); Boolean getBoolean(int index); @Nullable Boolean getOptionalBoolean(int index); Boolean getBoolean(int index, Boolean defaultValue); Long getLong(int index); @Nullable Long getOptionalLong(int index); Long getLong(int index, Long defaultValue); Double getDouble(int index); @Nullable Double getOptionalDouble(int index); Double getDouble(int index, Double defaultValue); String getString(int index); @Nullable String getOptionalString(int index); String getString(int index, String defaultValue); byte[] getRaw(int index); @Nullable byte[] getOptionalRaw(int index); byte[] getRaw(int index, byte[] defaultValue); BdfList getList(int index); @Nullable BdfList getOptionalList(int index); BdfList getList(int index, BdfList defaultValue); BdfDictionary getDictionary(int index); @Nullable BdfDictionary getOptionalDictionary(int index); BdfDictionary getDictionary(int index, BdfDictionary defaultValue); }
BdfList extends ArrayList<Object> { public Double getDouble(int index) throws FormatException { if (!isInRange(index)) throw new FormatException(); Object o = get(index); if (o instanceof Double) return (Double) o; if (o instanceof Float) return ((Float) o).doubleValue(); throw new FormatException(); } BdfList();  BdfList(List<Object> items); static BdfList of(Object... items); Boolean getBoolean(int index); @Nullable Boolean getOptionalBoolean(int index); Boolean getBoolean(int index, Boolean defaultValue); Long getLong(int index); @Nullable Long getOptionalLong(int index); Long getLong(int index, Long defaultValue); Double getDouble(int index); @Nullable Double getOptionalDouble(int index); Double getDouble(int index, Double defaultValue); String getString(int index); @Nullable String getOptionalString(int index); String getString(int index, String defaultValue); byte[] getRaw(int index); @Nullable byte[] getOptionalRaw(int index); byte[] getRaw(int index, byte[] defaultValue); BdfList getList(int index); @Nullable BdfList getOptionalList(int index); BdfList getList(int index, BdfList defaultValue); BdfDictionary getDictionary(int index); @Nullable BdfDictionary getOptionalDictionary(int index); BdfDictionary getDictionary(int index, BdfDictionary defaultValue);  }