Search in sources :

Example 1 with TDoubleIterator

use of gnu.trove.iterator.TDoubleIterator in project Terasology by MovingBlocks.

the class TroveUtils method doubleToFloat.

public static TFloatList doubleToFloat(TDoubleList list) {
    TFloatList result = new TFloatArrayList(list.size());
    TDoubleIterator iterator = list.iterator();
    while (iterator.hasNext()) {
        double i = iterator.next();
        result.add((float) i);
    }
    return result;
}
Also used : TDoubleIterator(gnu.trove.iterator.TDoubleIterator) TFloatList(gnu.trove.list.TFloatList) TFloatArrayList(gnu.trove.list.array.TFloatArrayList)

Example 2 with TDoubleIterator

use of gnu.trove.iterator.TDoubleIterator in project Terasology by MovingBlocks.

the class TroveUtils method doubleToLong.

public static TLongList doubleToLong(TDoubleList list) {
    TLongList result = new TLongArrayList(list.size());
    TDoubleIterator iterator = list.iterator();
    while (iterator.hasNext()) {
        double i = iterator.next();
        result.add((long) i);
    }
    return result;
}
Also used : TLongArrayList(gnu.trove.list.array.TLongArrayList) TDoubleIterator(gnu.trove.iterator.TDoubleIterator) TLongList(gnu.trove.list.TLongList)

Example 3 with TDoubleIterator

use of gnu.trove.iterator.TDoubleIterator in project Terasology by MovingBlocks.

the class TroveUtils method doubleToInt.

public static TIntList doubleToInt(TDoubleList list) {
    TIntList result = new TIntArrayList(list.size());
    TDoubleIterator iterator = list.iterator();
    while (iterator.hasNext()) {
        double i = iterator.next();
        result.add((int) i);
    }
    return result;
}
Also used : TDoubleIterator(gnu.trove.iterator.TDoubleIterator) TIntList(gnu.trove.list.TIntList) TIntArrayList(gnu.trove.list.array.TIntArrayList)

Aggregations

TDoubleIterator (gnu.trove.iterator.TDoubleIterator)3 TFloatList (gnu.trove.list.TFloatList)1 TIntList (gnu.trove.list.TIntList)1 TLongList (gnu.trove.list.TLongList)1 TFloatArrayList (gnu.trove.list.array.TFloatArrayList)1 TIntArrayList (gnu.trove.list.array.TIntArrayList)1 TLongArrayList (gnu.trove.list.array.TLongArrayList)1