int pos = getCount();
if (pos >= 0) {
hogehoge(pos);
}

というものを書いているのですが、
1行目と2行目をまとめて書く方法はありますでしょうか?

if ( (int pos = getCount()) >= 0 ) {

では駄目でした。当然ですが。