List of usage examples for com.google.common.collect Lists transform
@CheckReturnValue public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
From source file:com.streamsets.datacollector.activation.ActivationLoader.java
public Activation getActivation() { final Activation activation; ServiceLoader<Activation> serviceLoader = ServiceLoader.load(Activation.class); List<Activation> list = ImmutableList.copyOf(serviceLoader.iterator()); if (list.isEmpty()) { activation = new NopActivation(); LOG.debug("No activation service available, using {}", activation.getClass().getName()); } else if (list.size() == 1) { activation = list.get(0);//from w w w. j av a 2 s. c om LOG.debug("Found activation service {}", activation.getClass().getName()); } else { List<String> names = Lists.transform(list, element -> element.getClass().getName()); throw new RuntimeException(Utils.format( "There cannot be more than one Activation service, found '{}': {}", list.size(), names)); } LOG.debug("Initializing"); activation.init(runtimeInfo); LOG.debug("Initialized"); if (activation.isEnabled()) { Activation.Info info = activation.getInfo(); if (!info.isValid()) { LOG.info("Activation enabled, activation is not valid"); } else if (info.getExpiration() == -1) { LOG.info("Activation enabled, activation is valid and it does not expire"); } else { long daysToExpire = TimeUnit.MILLISECONDS.toDays(info.getExpiration() - System.currentTimeMillis()); LOG.info("Activation enabled, activation is valid and it expires in '{}' days", daysToExpire); } } else { LOG.debug("Activation disabled"); } return activation; }
From source file:org.sonatype.nexus.plugins.siesta.InvalidConfigurationExceptionMapper.java
@Override protected List<ValidationErrorXO> getValidationErrors(final InvalidConfigurationException exception) { final ValidationResponse validationResponse = exception.getValidationResponse(); if (validationResponse != null) { final List<ValidationMessage> validationErrors = validationResponse.getValidationErrors(); if (validationErrors != null && validationErrors.isEmpty()) { Lists.transform(validationErrors, new Function<ValidationMessage, ValidationErrorXO>() { @Nullable//from ww w . jav a 2 s.c om @Override public ValidationErrorXO apply(@Nullable final ValidationMessage validationMessage) { if (validationMessage != null) { return new ValidationErrorXO(validationMessage.getKey(), validationMessage.getMessage()); } return null; } }); } } return Lists.newArrayList(new ValidationErrorXO(exception.getMessage())); }
From source file:org.sosy_lab.cpachecker.util.predicates.interfaces.basicimpl.AbstractQuantifiedFormulaManager.java
@Override public final BooleanFormula forall(List<Formula> pVariables, BooleanFormula pBody) { return wrap(forall(Lists.transform(pVariables, extractor), extractInfo(pBody))); }
From source file:net.minecraftforge.fml.common.ModMetadata.java
public String getChildModList() { return Joiner.on(", ").join(Lists.transform(childMods, new ModNameFunction())); }
From source file:kr.co.vcnc.haeinsa.HaeinsaResult.java
/** * Transform HBase result to List of HaeinsaKeyValue *//*from www . ja va 2s .co m*/ private static List<HaeinsaKeyValue> toHaeinsaKVs(Result result) { List<HaeinsaKeyValue> sorted = Collections.emptyList(); if (!result.isEmpty()) { sorted = Lists.transform(result.list(), new Function<KeyValue, HaeinsaKeyValue>() { @Override public HaeinsaKeyValue apply(KeyValue kv) { return new HaeinsaKeyValue(kv); } }); } return sorted; }
From source file:org.summer.dsl.xbase.typesystem.internal.ResolvedConstructor.java
@Override protected List<LightweightTypeReference> getSyntacticTypeArguments() { return Lists.transform(getConstructorCall().getTypeArguments(), getState().getResolvedTypes().getConverter()); }
From source file:org.gradle.platform.base.internal.DefaultDependencySpecContainer.java
public Collection<DependencySpec> getDependencies() { if (builders.isEmpty()) { return Collections.emptySet(); }// w ww .j a v a2 s . c om return ImmutableSet .copyOf(Lists.transform(builders, new Function<DefaultDependencySpec.Builder, DependencySpec>() { @Override public DependencySpec apply(DefaultDependencySpec.Builder builder) { return builder.build(); } })); }
From source file:org.apache.druid.sql.calcite.filtration.Bounds.java
public static List<Range<BoundValue>> toRanges(final List<BoundDimFilter> bounds) { return ImmutableList.copyOf(Lists.transform(bounds, new Function<BoundDimFilter, Range<BoundValue>>() { @Override/*from ww w . ja va 2 s . c o m*/ public Range<BoundValue> apply(BoundDimFilter bound) { return toRange(bound); } })); }
From source file:org.impressivecode.depress.mg.ipa.IssuesMetricTableFactory.java
private static List<String> transform(final List<ITSDataType> issues) { return Lists.transform(issues, new Function<ITSDataType, String>() { @Override//from w w w. ja va2s .c o m public String apply(final ITSDataType its) { return its.getIssueId(); } }); }
From source file:kuona.jenkins.analyser.model.JobWithDetails.java
public List<Job> getDownstreamProjects() { return Lists.transform(downstreamProjects, new JobWithClient()); }