(1) List<?> myList = new ArrayList<?>();
(2) ArrayList<?> myList = new ArrayList<?>();
I understand that with (1), implementations of the List interface can be swapped. It seems that (1) is typically used in an application regardless of need (myself I always use this). I am wondering if anyone uses (2)? Also, how often (and can I please get an example) does the situation actually require using (1) over (2) (i.e. where (2) wouldn't suffice, aside from coding to interfaces and best practices etc.)
If you can always make do with (2) there is no situation that will require you to use (1). That said, I would never use (2) for the reasons you've already outlined.