List of usage examples for com.google.common.collect Iterables transform
@CheckReturnValue public static <F, T> Iterable<T> transform(final Iterable<F> fromIterable, final Function<? super F, ? extends T> function)
From source file:org.apache.isis.applib.util.Enums.java
public static String getEnumNameFromFriendly(String anEnumFriendlyName) { return Joiner.on("_").join(Iterables.transform(Splitter.on(" ").split(anEnumFriendlyName), UPPER_CASE)); }
From source file:cron.DateTimes.java
public static Iterable<Date> toDates(Iterable<ZonedDateTime> times) { return Iterables.transform(times, new Function<ZonedDateTime, Date>() { @Override/* w ww .ja v a 2 s . co m*/ public Date apply(ZonedDateTime input) { return Date.from(input.toInstant()); } }); }
From source file:org.janusgraph.graphdb.util.ElementHelper.java
public static Iterable<Object> getValues(JanusGraphElement element, PropertyKey key) { if (element instanceof JanusGraphRelation) { Object value = element.valueOrNull(key); if (value == null) return Collections.EMPTY_LIST; else/*ww w. j av a2 s. c om*/ return ImmutableList.of(value); } else { assert element instanceof JanusGraphVertex; return Iterables.transform((((JanusGraphVertex) element).query()).keys(key.name()).properties(), new Function<JanusGraphVertexProperty, Object>() { @Nullable @Override public Object apply(@Nullable JanusGraphVertexProperty janusgraphProperty) { return janusgraphProperty.value(); } }); } }
From source file:org.apache.isis.core.metamodel.facets.value.datejodalocal.JodaLocalDateUtil.java
static LocalDate parseDate(final String dateStr, List<DateTimeFormatter> parseFormatters) { final Locale locale = Locale.getDefault(); Iterable<DateTimeFormatter> elements = Iterables.transform(parseFormatters, JodaFunctions.withLocale(locale)); LocalDate parsedDate = parseDate(dateStr, elements); return parsedDate; }
From source file:org.eclipseday.xtext.example.entitydsl.utils.EntityDslScopeProviderUtil.java
/** * /*from w w w . j a va 2s . c o m*/ * @param scope * @param resourceSet * @return */ public static Set<EObject> unpack(final IScope scope, final ResourceSet resourceSet) { final Function<IEObjectDescription, EObject> function = new Function<IEObjectDescription, EObject>() { @Override public EObject apply(IEObjectDescription eObjectDescription) { return getEObject(eObjectDescription, resourceSet); } }; final Iterable<EObject> unpackaged = Iterables.transform(scope.getAllElements(), function); return Collections.unmodifiableSet(Sets.newLinkedHashSet(unpackaged)); }
From source file:org.eclipse.papyrus.uml.diagram.activity.activitygroup.functions.FromIGroupNotifierToEObject.java
public static Iterable<EObject> transform(Iterable<IGroupNotifier> from) { return Iterables.transform(from, FromIGroupNotifierToEObject.getInstance()); }
From source file:nl.socrates.dom.utils.StringUtils.java
public static String enumTitle(final String string) { if (string == null) { return null; }/*from w w w . ja v a 2 s . c om*/ return Joiner.on(" ").join(Iterables.transform(Splitter.on("_").split(string), LOWER_CASE_THEN_CAPITALIZE)); }
From source file:org.richfaces.cdk.util.MorePredicates.java
public static <S, D> Predicate<D> any(Iterable<S> options, Function<S, Predicate<D>> function) { if (options == null || Iterables.isEmpty(options)) { return Predicates.alwaysTrue(); }//from w w w . ja v a 2s .c o m return Predicates.or(Iterables.transform(options, function)); }
From source file:org.apache.isis.core.metamodel.facets.value.datetimejodalocal.JodaLocalDateTimeUtil.java
static LocalDateTime parseDate(final String dateStr, List<DateTimeFormatter> parseFormatters) { final Locale locale = Locale.getDefault(); Iterable<DateTimeFormatter> elements = Iterables.transform(parseFormatters, JodaFunctions.withLocale(locale)); return parseDateTime(dateStr, elements); }
From source file:org.apache.isis.core.progmodel.facets.value.datejodalocal.JodaLocalDateUtil.java
static LocalDate parseDate(final String dateStr, final Localization localization, List<DateTimeFormatter> parseFormatters) { Iterable<DateTimeFormatter> elements = Iterables.transform(parseFormatters, JodaFunctions.withLocale(localization)); LocalDate parsedDate = parseDate(dateStr, elements); return parsedDate; }