public class FormatUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ISO_8601_PATTERN
Date-time ISO-8601 pattern.
|
Constructor and Description |
---|
FormatUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatBearings(java.util.List<Bearing> bearings)
Formats the bearing variables from the raw values to a string ready for API consumption.
|
static java.lang.String |
formatDistributions(java.util.List<java.lang.Integer[]> distributions)
Converts the list of distributions to a string ready for API consumption.
|
static java.lang.String |
formatDouble(double value)
Useful to remove any trailing zeros and prevent a double being over 7 significant figures.
|
static java.lang.String |
formatIntegers(java.util.List<java.lang.Integer> integers)
Converts list of integers to a string ready for API consumption.
|
static java.lang.String |
formatPointsList(java.util.List<com.mapbox.geojson.Point> points)
Converts list of points to a string ready for API consumption.
|
static java.lang.String |
formatRadiuses(java.util.List<java.lang.Double> radiuses)
Used in various APIs to format the user provided radiuses to a String matching the APIs
format.
|
static java.lang.String |
join(java.lang.CharSequence delimiter,
java.util.List<?> tokens)
Returns a string containing the tokens joined by delimiters.
|
public static final java.lang.String ISO_8601_PATTERN
@Nullable public static java.lang.String join(@NonNull java.lang.CharSequence delimiter, @Nullable java.util.List<?> tokens)
delimiter
- the delimiter on which to split.tokens
- A list of objects to be joined. Strings will be formed from the objects by
calling object.toString().
If a token in a list is null, an empty string is appended in its place.String
with joint values, empty string if the token list was empty,
or null if the tokens list was null@NonNull public static java.lang.String formatDouble(double value)
value
- a double value@Nullable public static java.lang.String formatRadiuses(@Nullable java.util.List<java.lang.Double> radiuses)
radiuses
- a list of doubles represents the radius values@Nullable public static java.lang.String formatBearings(@Nullable java.util.List<Bearing> bearings)
bearings
- a List of Bearing
values@Nullable public static java.lang.String formatDistributions(@Nullable java.util.List<java.lang.Integer[]> distributions)
distributions
- the list of integer arrays representing the distribution@Nullable public static java.lang.String formatPointsList(@Nullable java.util.List<com.mapbox.geojson.Point> points)
points
- a list representing of points@Nullable public static java.lang.String formatIntegers(@Nullable java.util.List<java.lang.Integer> integers)
integers
- a list of integers