Example usage for com.google.common.primitives Ints lastIndexOf

List of usage examples for com.google.common.primitives Ints lastIndexOf

Introduction

In this page you can find the example usage for com.google.common.primitives Ints lastIndexOf.

Prototype

public static int lastIndexOf(int[] array, int target) 

Source Link

Document

Returns the index of the last appearance of the value target in array .

Usage

From source file:org.eclipse.recommenders.jayes.transformation.AbstractDecomposition.java

private AbstractFactor reorderFactor(AbstractFactor f) {
    int[] dimensions = f.getDimensions();
    int min = Ints.min(dimensions);
    int minIndex = Ints.lastIndexOf(dimensions, min);

    if (minIndex == dimensions.length - 1)
        return f;
    int[] nDim = rotateRight(dimensions, dimensions.length - 1 - minIndex);
    int[] nIDs = rotateRight(f.getDimensionIDs(), dimensions.length - 1 - minIndex);

    AbstractFactor f2 = new DenseFactor();
    f2.setDimensionIDs(nIDs);/*  w w w  .  j  a  v a  2s  . co m*/
    f2.setDimensions(nDim);
    f2.fill(1);
    f2.multiplyCompatible(f);

    return f2;
}

From source file:com.opengamma.strata.collect.array.IntArray.java

/**
 * Find the index of the first occurrence of the specified value.
 * //  www.j ava 2 s  .  c  o m
 * @param value  the value to find
 * @return the index of the value, -1 if not found
 */
public int lastIndexOf(int value) {
    return Ints.lastIndexOf(array, value);
}