Java BigDecimal from toBigDecimalList(double... list)

Here you can find the source of toBigDecimalList(double... list)

Description

Returns a list of BigDecimal based on a list of doubles.

License

Apache License

Parameter

Parameter Description
list The list of doubles to convert to BigDecimal.

Return

A list of based on a list of doubles.

Declaration

public static List<BigDecimal> toBigDecimalList(double... list) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright 2014 Felipe Takiyama//from w w w  .  j a  va  2  s. com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

import java.math.BigDecimal;
import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
     * Returns a list of {@link BigDecimal} based on a list of doubles.
     * @param list The list of doubles to convert to BigDecimal.
     * @return A list of {@link BigDecimal} based on a list of doubles.
     */
    public static List<BigDecimal> toBigDecimalList(double... list) {
        List<BigDecimal> result = new ArrayList<BigDecimal>(list.length);
        for (int i = 0; i < list.length; i++) {
            result.add(BigDecimal.valueOf(list[i]));
        }
        return result;
    }
}

Related

  1. toBigDecimal(String value)
  2. toBigDecimal(String value)
  3. toBigDecimal(T value)
  4. toBigDecimal(Vector doubleVector)
  5. toBigDecimalArray(int[] ints)
  6. toBigDecimalList(List list)
  7. toBigInteger(@Nullable final BigDecimal value)
  8. toBigIntString(final BigDecimal bigD)