Well, what about something like:
ArrayBlockingQueue<Work> q = new ArrayBlockingQueue<Work>(10) ArrayBlockingQueue<Work> q = new ArrayBlockingQueue<Work>(10) BlockingQueue<Work> q = new ArrayBlockingQueue<>(10)
right? You'd use the interface type that you'd want to be working on, so you could replace the ArrayBlockingQueue if needed and be sure you're not using any specific functions.Still seems better than having a 'val' in there, since it signals exactly what aspect of the object you're using. Plus now the compiler will complain if you change ArrayBlockingQueue to something that isn't a queue.
I just don't really see the benefit - so what if it saves a couple keystrokes? I don't think I've ever run out of keystrokes before... Meanwhile if it saves a single logic error or helps the compiler detect a mistake, then it's saved a lot of real effort.