protected CliEnvironment createMainEnvironment ( final AtomicReference < InputReader > dynamicInputReaderRef , final AtomicReference < History > dynamicHistoryAtomicReference ) { final Map < String , ? > data = new HashMap < String , Object > ( ) ; return new CliEnv ( ) { @ Override public History history ( ) { return dynamicHistoryAtomicReference . get ( ) ; } @ Override public InputReader reader ( ) { return dynamicInputReaderRef . get ( ) ; } @ Override public Map < String , ? > userData ( ) { return data ; } } ; }
java 8 would have use Supplier which is cleaner