lundi 9 mars 2015

Java initializing an integer and adding it to a list in one line



A tiny annoyance I have in my code right now - these two lines of code:



int i = 1;
listOfIntegers.add(i);


I would really like these to be one line but I can't for the life of me find anything like "new int[] {1}" or similar. Is this possible?




Aucun commentaire:

Enregistrer un commentaire