/* * MyHashCanvas.java */ package homework1.solution; /** * @author Yim */ public class MyHashCanvas extends ija.HashCanvas implements ija.MyCanvas { int [] arr = new int[10]; /** Creates a new instance of MyHashCanvas */ public MyHashCanvas(String o1, int size) { super(o1); this.arr = new int[size]; } public void put(Object o1, int o2) { super.put(o1, o2); arr[o2]++; } public void remove(Object o) { int barva = super.get(o); arr[barva]--; super.remove(o); } public int numOfColour(int c) { return this.arr[c]; } }