public Map < Integer , List < HeronTuples . HeronTupleSet > > getCache ( ) { Map < Integer , List < HeronTuples . HeronTupleSet > > res = new HashMap <> ( ) ; for ( Map . Entry < Integer , TupleList > entry : cache . entrySet ( ) ) { res . put ( entry . getKey ( ) , entry . getValue ( ) . getTuplesList ( ) ) ; } return res ; }
Modification on Map would not cahnge values in cache