protected void handleFeedImages ( List < Pair < String , CharSequence > > params , Collection < IFeedImage > images ) { if ( images != null && images . size ( ) > 4 ) { throw new IllegalArgumentException ( "At most four images are allowed, got " + Integer . toString ( images . size ( ) ) ) ; } if ( null != images && ! images . isEmpty ( ) ) { int image_count = 0 ; for ( IFeedImage image : images ) { ++ image_count ; String imageUrl = image . getImageUrlString ( ) ; assert null != imageUrl && "" . equals ( imageUrl ) : "Image URL must be provided" ; params . add ( new Pair < String , CharSequence > ( String . format ( "image_%d" , image_count ) , image . getImageUrlString ( ) ) ) ; assert null != image . getLinkUrl ( ) : "Image link URL must be provided" ; params . add ( new Pair < String , CharSequence > ( String . format ( "image_%d_link" , image_count ) , image . getLinkUrl ( ) . toString ( ) ) ) ; } } }
Adds image parameters to a list of parameters