public static <T> Map<T, Object> nextRequestOptions(
      T pageTokenOption, String cursor, Map<T, ?> optionMap) {
    ImmutableMap.Builder<T, Object> builder = ImmutableMap.builder();
    if (cursor != null) {
      builder.put(pageTokenOption, cursor);
    }
    for (Map.Entry<T, ?> option : optionMap.entrySet()) {
      if (!Objects.equals(option.getKey(), pageTokenOption)) {
        builder.put(option.getKey(), option.getValue());
      }
    }
    return builder.build();
  }
public static < T > Map < T , Object > nextRequestOptions ( T pageTokenOption , String cursor , Map < T , ? > optionMap ) { ImmutableMap . Builder < T , Object > builder = ImmutableMap . builder ( ) ; if ( cursor != null ) { builder . put ( pageTokenOption , cursor ) ; } for ( Map . Entry < T , ? > option : optionMap . entrySet ( ) ) { if ( ! Objects . equals ( option . getKey ( ) , pageTokenOption ) ) { builder . put ( option . getKey ( ) , option . getValue ( ) ) ; } } return builder . build ( ) ; }
Utility method to construct the options map for the next page request.

@param <T> the value type that the page holds. Instances of {@code T} should be {@code
Serializable}
@param pageTokenOption the key for the next page cursor option in the options map
@param cursor the cursor for the next page
@param optionMap the previous options map
@return the options map for the next page request