public static Array create(List<Object> values, List<Integer> indices) throws Exception { ArrayType type = null; Object first = values.get(0); if ((first instanceof Double) || (first instanceof Float)) { type = ArrayType.REAL; } else if ((first instanceof Integer) || (first instanceof Long)) { type = ArrayType.INT; } else if ((first instanceof String)) { type = ArrayType.STRING; } else { throw new Exception("[Array] unsupport type!"); } if (indices != null) { // array is sparse if (indices.size() != values.size()) { throw new Exception("[Array] num values is not equal to num indices!!"); } if (type == ArrayType.REAL) { type = ArrayType.REAL_SPARSE; } else if (type == ArrayType.INT) { type = ArrayType.INT_SPARSE; } else { throw new Exception( "[Array] sparse arrays can only be integer, long, float or double!"); } return new SparseArray(type, values, indices); } return new Array(type, values); }
public static Array create(List<Object> values, List<Integer> indices) throws Exception { ArrayType type = null; Object first = values.get(0); if ((first instanceof Double) || (first instanceof Float)) { type = ArrayType.REAL; } else if ((first instanceof Integer) || (first instanceof Long)) { type = ArrayType.INT; } else if ((first instanceof String)) { type = ArrayType.STRING; } else { throw new Exception("[Array] unsupport type!"); } if (indices != null) { // array is sparse if (indices.size() != values.size()) { throw new Exception("[Array] num values is not equal to num indices!!"); } if (type == ArrayType.REAL) { type = ArrayType.REAL_SPARSE; } else if (type == ArrayType.INT) { type = ArrayType.INT_SPARSE; } else { throw new Exception( "[Array] sparse arrays can only be integer, long, float or double!"); } return new SparseArray(type, values, indices); } return new Array(type, values); }
private final float mDensity; private SparseArray<BitmapDescriptor> mIcons = new SparseArray();
/** * Static factory method for creating non-sparse or sparse array types as * needed. * * @param arrayE the XML element encapsulating the array * @return an appropriate Array type * @throws Exception if there is a problem when constructing the array */ public static Array create(Element arrayE) throws Exception { if (!isArray(arrayE)) { throw new Exception( "[Array] the supplied element does not contain an array!"); } if (isSparseArray(arrayE)) { return new SparseArray(arrayE); } return new Array(arrayE); }
/** * Static factory method for creating non-sparse or sparse array types as * needed. * * @param arrayE the XML element encapsulating the array * @return an appropriate Array type * @throws Exception if there is a problem when constructing the array */ public static Array create(Element arrayE) throws Exception { if (!isArray(arrayE)) { throw new Exception( "[Array] the supplied element does not contain an array!"); } if (isSparseArray(arrayE)) { return new SparseArray(arrayE); } return new Array(arrayE); }
private SparseArray<BitmapDescriptor> mIcons = new SparseArray(); private final float mDensity; private Context mContext;