How to use an array containing Pair objects?

53 Views Asked by At

My array:

private Object[] arr = new Pair[initialCapacity];

My Pair class:

private static class Pair<V> {
    private String key;
    private V value;

    public Pair(String key, V value) {
        this.key = key;
        this.value = value;
    }
}

I'm trying to get the properties of the objects like this:

arr[startPos].key

but I get the error "cannot find symbol - variable key"

0

There are 0 best solutions below