I have the following three enums:

**PlayerType**

```
public enum PlayerType {
    NONE (' '),
    BLACK ('b'),
    WHITE ('w');

    private final char _symbol;

    PlayerType(char symbol) {
        _symbol = symbol;
    }

    public char symbol() { return _symbol; }
}

```

**PieceType**

```
public enum PieceType {
    NONE (' '),
    PAWN ('p'),
    KNIGHT ('n'),
    BISHOP ('b'),
    ROOK ('r'),
    QUEEN ('q'),
    KING ('k');

    private final char _symbol;

    PieceType(char symbol) {
        _symbol = symbol;
    }

    public char symbol() { return _symbol; }
}

```

**PlayerPiece**

```
public enum PlayerPiece {
    NONE (PlayerType.NONE, PieceType.NONE),
    BLACK_PAWN (PlayerType.BLACK, PieceType.PAWN),
    BLACK_KNIGHT (PlayerType.BLACK, PieceType.KNIGHT),
    BLACK_BISHOP (PlayerType.BLACK, PieceType.BISHOP),
    BLACK_ROOK (PlayerType.BLACK, PieceType.ROOK),
    BLACK_QUEEN (PlayerType.BLACK, PieceType.QUEEN),
    BLACK_KING (PlayerType.BLACK, PieceType.KING),
    WHITE_PAWN (PlayerType.WHITE, PieceType.PAWN),
    WHITE_KNIGHT (PlayerType.WHITE, PieceType.KNIGHT),
    WHITE_BISHOP (PlayerType.WHITE, PieceType.BISHOP),
    WHITE_ROOK (PlayerType.WHITE, PieceType.ROOK),
    WHITE_QUEEN (PlayerType.WHITE, PieceType.QUEEN),
    WHITE_KING (PlayerType.WHITE, PieceType.KING);

    private final PlayerType _playerType;
    private final PieceType _pieceType;
    private final char[] _symbol;

    private PlayerPiece(
      final PlayerType playerType,
      final PieceType pieceType) {
        _playerType = playerType;
        _pieceType = pieceType;
        _symbol = new char[] {playerType.symbol(), pieceType.symbol()};
    }

    public final PlayerType playerType() { return _playerType; }
    public final PieceType pieceType() { return _pieceType; }
    public final String symbol() { return String.valueOf(_symbol); }
}

```

A lookup like ...

```
int playerTypeOrdinal = PlayerType.WHITE.ordinal();
int pieceTypeOrdinal = PieceType.QUEEN.ordinal();
PlayerPiece playerPiece = Lookup(playerTypeOrdinal, pieceTypeOrdinal)

```

... should return the WHITE\_QUEEN PlayerPiece enum as fast as possible. I could use a for loop, however I am not sure this is the fastest approach. I want to use a static Map but not sure how to use two ordinals as the key.

Any suggestions how this can be done efficiently?

SOLUTION FROM ACCEPTED ANSWER

That works, even as a staggered array, however there exists the possibility of an ArrayIndexOutOfBoundsException thrown if I don't make them parallel:

```
public class PlayerPieceLookup {

    private static final PlayerPiece[][] PLAYER_PIECES = new PlayerPiece[][] {
        {
            PlayerPiece.NONE,
            PlayerPiece.NONE,
            PlayerPiece.NONE,
            PlayerPiece.NONE,
            PlayerPiece.NONE,
            PlayerPiece.NONE,
            PlayerPiece.NONE,
        },
        {
            PlayerPiece.NONE,
            PlayerPiece.BLACK_PAWN, 
            PlayerPiece.BLACK_KNIGHT, 
            PlayerPiece.BLACK_BISHOP, 
            PlayerPiece.BLACK_ROOK, 
            PlayerPiece.BLACK_QUEEN, 
            PlayerPiece.BLACK_KING
        },
        {
            PlayerPiece.NONE,
            PlayerPiece.WHITE_PAWN, 
            PlayerPiece.WHITE_KNIGHT,
            PlayerPiece.WHITE_BISHOP, 
            PlayerPiece.WHITE_ROOK, 
            PlayerPiece.WHITE_QUEEN, 
            PlayerPiece.WHITE_KING
        }       
    };  

    public static void main(String[] args) {
        for(PlayerType player : PlayerType.values()) {
            for(PieceType piece : PieceType.values()) {
                System.out.println("[" + player + "][" + piece + "][" + PLAYER_PIECES[player.ordinal()][piece.ordinal()] + "]");        
            }
        }
    }
 }

```