Java Code Examples for com.helger.commons.collection.CollectionHelper#newListMapped()

The following examples show how to use com.helger.commons.collection.CollectionHelper#newListMapped() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ICommonsMap.java    From ph-commons with Apache License 2.0 3 votes vote down vote up
/**
 * Create a copy of all values after applying the passed mapping function.
 *
 * @param aMapper
 *        The mapping function to be applied. May not be <code>null</code>.
 * @return A new list with all mapped values.
 * @param <DSTTYPE>
 *        The destination type to be mapped to
 * @see #values()
 * @see #copyOfValues()
 * @see #copyOfValuesMapped(Function)
 * @see #copyOfValuesMapped(Predicate, Function)
 */
@Nonnull
@ReturnsMutableCopy
default <DSTTYPE> ICommonsList <DSTTYPE> copyOfValuesMapped (@Nonnull final Function <? super VALUETYPE, ? extends DSTTYPE> aMapper)
{
  return CollectionHelper.newListMapped (values (), aMapper);
}
 
Example 2
Source File: ICommonsMap.java    From ph-commons with Apache License 2.0 3 votes vote down vote up
/**
 * Create a copy of all values matching the passed filter which are then
 * converted using the provided function.
 *
 * @param aFilter
 *        The filter to be applied. May be <code>null</code>.
 * @param aMapper
 *        The mapping function to be applied. May not be <code>null</code>.
 * @return A new list with all matching converted values. If no filter is
 *         provided the returned value is identical as of
 *         {@link #copyOfValuesMapped(Function)}
 * @param <DSTTYPE>
 *        The destination type to be mapped to
 * @see #values()
 * @see #copyOfValues()
 * @see #copyOfValues(Predicate)
 * @see #copyOfValuesMapped(Predicate, Function)
 */
@Nonnull
@ReturnsMutableCopy
default <DSTTYPE> ICommonsList <DSTTYPE> copyOfValuesMapped (@Nullable final Predicate <? super VALUETYPE> aFilter,
                                                             @Nonnull final Function <? super VALUETYPE, ? extends DSTTYPE> aMapper)
{
  if (aFilter == null)
    return copyOfValuesMapped (aMapper);
  return CollectionHelper.newListMapped (values (), aFilter, aMapper);
}