Java Code Examples for com.helger.commons.collection.impl.CommonsArrayList#addAllMapped()

The following examples show how to use com.helger.commons.collection.impl.CommonsArrayList#addAllMapped() . 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: CollectionHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> CommonsArrayList <DSTTYPE> newListMapped (@Nullable final SRCTYPE [] aValues,
                                                                           @Nonnull final Function <? super SRCTYPE, ? extends DSTTYPE> aMapper)
{
  // Don't user Arrays.asList since aIter returns an unmodifiable list!
  if (ArrayHelper.isEmpty (aValues))
    return newList (0);

  final CommonsArrayList <DSTTYPE> ret = newList (aValues.length);
  ret.addAllMapped (aValues, aMapper);
  return ret;
}
 
Example 2
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public static <ELEMENTTYPE, DSTTYPE> CommonsArrayList <DSTTYPE> newListMapped (@Nullable final Iterable <? extends ELEMENTTYPE> aIter,
                                                                               @Nonnull final Function <? super ELEMENTTYPE, ? extends DSTTYPE> aMapper)
{
  final CommonsArrayList <DSTTYPE> ret = newList ();
  ret.addAllMapped (aIter, aMapper);
  return ret;
}
 
Example 3
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> CommonsArrayList <DSTTYPE> newListMapped (@Nullable final Collection <? extends SRCTYPE> aCollection,
                                                                           @Nonnull final Function <? super SRCTYPE, ? extends DSTTYPE> aMapper)
{
  if (isEmpty (aCollection))
    return newList (0);
  final CommonsArrayList <DSTTYPE> ret = newList (aCollection.size ());
  ret.addAllMapped (aCollection, aMapper);
  return ret;
}
 
Example 4
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public static <ELEMENTTYPE, DSTTYPE> CommonsArrayList <DSTTYPE> newListMapped (@Nullable final Iterable <? extends ELEMENTTYPE> aCollection,
                                                                               @Nullable final Predicate <? super ELEMENTTYPE> aFilter,
                                                                               @Nonnull final Function <? super ELEMENTTYPE, ? extends DSTTYPE> aMapper)
{
  final CommonsArrayList <DSTTYPE> ret = newList ();
  ret.addAllMapped (aCollection, aFilter, aMapper);
  return ret;
}