I have created a hashmap in a singleton class, we will call it Class A. I have also created a TableModel class that extends AbstractTableModel, we will call it Class B. In Class C, I am wanting to use the values in my hashmap to populate a jtable.
My question is how do I get the hashmap to Class B?
Use Composition….
A a = A.getInstance();// I am assuming getInstance() is the method to return the Singleton reference of class A.a.myHash.getKey();// Call any method you want….B b = new B();// As B is not singleton, we can use “new”Now fill the table in B with the data in HashMap