HashMap implementation using PriorityQueue || Java
Intuition
Use a HashMap to store number at a praticular index
Use second HashMap to map each number to a min heap of indices
Complexity
Time complexity:O(logn)
# Intuition
- Use a HashMap to store number at a praticular index
- Use second HashMap to map each number to a min heap of indices
<!-- Describe your first thoughts on how to solve this problem. -->


# Complexity
- Time complexity:$$O(logn)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:$$O(m+n)$$ m different numbers at n indices
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class NumberContainers {
    private HashMap<Integer, Integer> indtonum;
    private HashMap<Integer, PriorityQueue<Integer>> numtoind;
    public NumberContainers() {
        indtonum = new HashMap<>();
        numtoind = new HashMap<>();
    }
    public void change(int index, int number) {
        indtonum.put(index, number);   
        if (!numtoind.containsKey(number)) {
            numtoind.put(number, new PriorityQueue<>());
        }
        numtoind.get(number).add(index);
    }
    public int find(int number) {
        PriorityQueue<Integer> minHeap = numtoind.get(number);
        if (minHeap == null) {
            return -1;
        }
        while (!minHeap.isEmpty()) {
            int idx = minHeap.peek();
            if (indtonum.get(idx) == number) {
                return idx;
            }
            minHeap.poll();
        }
        return -1;
    }
}

/**
 * Your NumberContainers object will be instantiated and called as such:
 * NumberContainers obj = new NumberContainers();
 * obj.change(index,number);
 * int param_2 = obj.find(number);
 */
```
['Hash Table', 'Design', 'Heap (Priority Queue)', 'Java']