public static final SerIterable array ( final Class < ? > valueType ) { final List < Object > list = new ArrayList <> ( ) ; return new SerIterable ( ) { @ Override public SerIterator iterator ( ) { return array ( build ( ) , Object . class , valueType ) ; } @ Override public void add ( Object key , Object column , Object value , int count ) { if ( key != null ) { throw new IllegalArgumentException ( "Unexpected key" ) ; } if ( count != 1 ) { throw new IllegalArgumentException ( "Unexpected count" ) ; } for ( int i = 0 ; i < count ; i ++ ) { list . add ( value ) ; } } @ Override public Object [ ] build ( ) { Object [ ] array = ( Object [ ] ) Array . newInstance ( valueType , list . size ( ) ) ; return list . toArray ( array ) ; } @ Override public Class < ? > valueType ( ) { return valueType ; } @ Override public List < Class < ? > > valueTypeTypes ( ) { return EMPTY_VALUE_TYPES ; } } ; }
Gets an iterable wrapper for an object array .