class GridUtils {

    public static int getGridIndexByDimensionItem( List<Object> row, List<DimensionalItemObject> items, int defaultIndex )
    {
        // accumulate the DimensionalItemObject identifiers into a List
        List<String> valid = items.stream().map( DimensionalItemObject::getDimensionItem )
            .collect( Collectors.toList() );

        // skip the last index, since it is always the row value
        for ( int i = 0; i < row.size() -1 ; i++ )
        {
            final String value = (String) row.get( i );
            if ( valid.contains( value ) )
            {
                return i;
            }
        }
        return defaultIndex;
    }

}