protected List<String> normalizeIterable(final Iterable<String> items) { return toStream(items) .map(StringQuerySortingModel::normalize).collect(toList()); }
private List<String> quotify(final Iterable<ZonedDateTime> values) { return toStream(values).map(this::quotify).collect(Collectors.toList()); }
/** * {@inheritDoc} */ @Override public List<FilterExpression<T>> containsAll(final Iterable<V> values) { return toStream(values) .map(value -> filterBy(value)) .collect(toList()); }
/** * Turns a group of terms into an expression of the form ":term1,term2,..." * @return the generated term expression. */ @Override public String value() { return ":" + toStream(terms) .map(t -> serializer().apply(t)) .filter(t -> !t.isEmpty()) .collect(joining(",")); } }
@Override public QueryPredicate<T> isIn(final Iterable<Locale> args) { final List<String> LocalesStringList = toStream(args) .map(v -> v.toLanguageTag()) .map(code -> '"' + code + '"') .collect(toList()); return isInPredicate(LocalesStringList); }
@Override public QueryPredicate<T> isIn(final Iterable<CountryCode> args) { final List<String> countryCodesStringList = toStream(args) .map(CountryCode::getAlpha2) .map(code -> '"' + code + '"') .collect(toList()); return isInPredicate(countryCodesStringList); }
/** * {@inheritDoc} */ @Override public List<FilterExpression<T>> containsAllAsString(final Iterable<String> values) { return toStream(values) .map(value -> filterByAsString(value)) .collect(toList()); }
protected <E extends SphereEnumeration> List<String> transformSphereEnumeration(final Iterable<E> items) { return toStream(items) .map(enumValue -> enumValue.toSphereName()) .map(StringQuerySortingModel::normalize) .collect(Collectors.toList()); }
private static List<String> escape(final Iterable<String> args) { return toStream(args).map(x -> escape(x)).collect(toList()); } }
/** * Searches the translation for some exact locales in the order they appear and returning the result in an {@link Optional}. * * {@include.example io.sphere.sdk.models.LocalizedStringTest#findByMultipleLocales()} * * @param locales the locale which should be searched, the first exact match wins * @return A filled optional with the translation belonging to one of the {@code locales} or an empty optional if none of the locales is not present. */ @Nonnull public Optional<String> find(final Iterable<Locale> locales) { final Optional<Locale> firstFoundLocale = toStream(locales).filter(locale -> translations.containsKey(locale)).findFirst(); return firstFoundLocale.map(foundLocale -> get(foundLocale)); }
private static List<String> normalize(final Iterable<String> args) { return toStream(args).map(x -> normalize(x)).collect(toList()); }
default String attributePath() { return toStream(buildPath()).collect(joining(".")); }
public static <T> List<String> toIds(final Iterable<? extends Identifiable<T>> elements) { return toStream(elements).map(element -> element.getId()).collect(toList()); }
/** * Turns a group of ranges into an expression of the form ":range(e1 to e2),(e3 to e4),..." * @return the generated range expression. */ public String value() { return ":range" + toStream(ranges) .map(r -> r.serialize(serializer())) .filter(r -> !r.isEmpty()) .collect(joining(",")); } }
private List<String> toSphereNameList(final Iterable<E> args) { return toStream(args) .map(e -> normalize(e.toSphereName())) .collect(toList()); }
@Override public final QueryPredicate<T> isIn(final Iterable<? extends Referenceable<R>> references) { final List<String> ids = toStream(references).map(r -> r.toReference().getId()).collect(toList()); return id().isIn(ids); }