java - sorting an array in the same line as instantiation/initialization -


if given array of ints:

int[] age = new int [] {32, 25, 56, 56, 12, 20, 22, 19, 54, 22}; 

is there way sort(lowest-highest) in same line instantiation/initialization, elements of age be: 12, 19, 20, 22...?

not same line.

but can do:

public static int[] sort(int[] a) {    arrays.sort(a);    return a; } // ... int[] age = sort(new int[] {32, 25, 56, 56, 12, 20, 22, 19, 54, 22}); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -