Here, Hamlet is using a metaphor. Metaphors compare two things, yet differ from similes in that they don't use "like" or "as." He is comparing Denmark to a prison, meaning that he feels that the city is confining and bleak.
Sam has different priorities way of looking at life
It has stage, sound, and acting directions