public static ImmutableIntArray of ( int first , int ... rest ) { checkArgument ( rest . length <= Integer . MAX_VALUE - 1 , "the total number of elements must fit in an int" ) ; int [ ] array = new int [ rest . length + 1 ] ; array [ 0 ] = first ; System . arraycopy ( rest , 0 , array , 1 , rest . length ) ; return new ImmutableIntArray ( array ) ; }
okay since we have to copy the just - created array anyway .