Files

13 lines
869 B
Plaintext

Q19 LazyProxy: RealStorage instances before first read=0, after two reads=1
Q19 ProtectionProxy: read("secret-1") -> SecurityException: denied: secret-1
Q19 Decorators stacked Logging(Caching(Real)): read("k") twice -> log=[read k, read k]
Q20 proxy.greet("Ankur") -> hello Ankur; intercepted=[greet]
Q20 Proxy.isProxyClass(proxy.getClass())=true; proxy instanceof Greeter.Impl=false
Q20 newProxyInstance with a class instead of an interface -> IllegalArgumentException (... is not an interface)
Q21 adapter: 98.6F read through CelsiusSensor -> 37.0 C
Q21 facade: watchMovie() -> [lights dimmed, projector on, surround sound on]
Q21 JDK adapter InputStreamReader(InputStream) first char: h
Q22 size() of a leaf=10, of sub dir=25, of root=35
Q23 "hello world" has 11 characters but the pool holds 8 Glyph objects
Q23 Integer.valueOf: 127==127 -> true, 128==128 -> false