Example usage for com.google.common.primitives Doubles ensureCapacity

List of usage examples for com.google.common.primitives Doubles ensureCapacity

Introduction

In this page you can find the example usage for com.google.common.primitives Doubles ensureCapacity.

Prototype

public static double[] ensureCapacity(double[] array, int minLength, int padding) 

Source Link

Document

Returns an array containing the same values as array , but guaranteed to be of a specified minimum length.

Usage

From source file:org.apache.samoa.core.DoubleVector.java

public void setValue(int index, double value) {
    if (index >= doubleArray.length) {
        this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0);
    }/* w w w  .jav a2 s .co m*/
    this.doubleArray[index] = value;
}

From source file:org.apache.samoa.core.DoubleVector.java

public void addToValue(int index, double value) {
    if (index >= doubleArray.length) {
        this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0);
    }//from ww  w  .j  a  v  a  2  s.  c o  m
    this.doubleArray[index] += value;
}