Of course it is possible:
Hashtable table = new Hashtable(); table.put(table, table); System.out.println("table = " + table);
outputs:
table = {(this Map)=(this Map)}
Please note, however, that the behavior of such a card may be unexpected (since its hash code will change and equal). For example, in the example below, you cannot remove the card from yourself after adding another record:
Hashtable table = new Hashtable(); table.put(table, table); System.out.println("table = " + table); table.put("abc", "def"); System.out.println("table = " + table); table.remove(table);
outputs:
table = {(this Map)=(this Map)} table = {abc=def, (this Map)=(this Map)} table = {abc=def, (this Map)=(this Map)}
source share