public static TypeFactory < ? > typeFactory ( TypeFactory < ? > type , int tupleSize ) { if ( tupleSize <= 1 ) return type ; if ( tupleSize == 2 ) return typeFactory ( type , type ) ; if ( tupleSize == 3 ) return typeFactory ( type , type , type ) ; if ( tupleSize == 4 ) return typeFactory ( type , type , type , type ) ; Collection < TypeFactory < ? > > types = new ArrayList <> ( tupleSize ) ; for ( int i = 0 ; i != tupleSize ; ++ i ) { types . add ( type ) ; } return new TupleNTypeFactory ( types ) ; }
Create a type factory for uniform tuples .