Is there an auto variable type in Java like you have in C++?
auto
An example:
for ( auto var : object_array) std::cout << var <<
Might be Java 10 has what you (and I) want, through the var keyword.
var
var list = new ArrayList(); // infers ArrayList var stream = list.stream(); // infers Stream
From JDK Enhancement Proposals 286
Update: Yap, that feature made it into the Java 10 release!