Java Code Examples for com.helger.commons.collection.impl.ICommonsSet#addAll()

The following examples show how to use com.helger.commons.collection.impl.ICommonsSet#addAll() . 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 6 votes vote down vote up
@Nullable
@ReturnsMutableCopy
public static <ELEMENTTYPE> ICommonsSet <ELEMENTTYPE> getConcatenatedSet (@Nullable final Collection <? extends ELEMENTTYPE> aCont1,
                                                                          @Nullable final Collection <? extends ELEMENTTYPE> aCont2)
{
  final int nSize1 = getSize (aCont1);
  if (nSize1 == 0)
    return newSet (aCont2);

  final int nSize2 = getSize (aCont2);
  if (nSize2 == 0)
    return newSet (aCont1);

  final ICommonsSet <ELEMENTTYPE> ret = newSet (nSize1 + nSize2);
  ret.addAll (aCont1);
  ret.addAll (aCont2);
  return ret;
}
 
Example 2
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> ICommonsSet <ELEMENTTYPE> getConcatenatedSet (@Nullable final Collection <? extends ELEMENTTYPE> aCont1,
                                                                          @Nullable final ELEMENTTYPE... aCont2)
{
  final int nSize1 = getSize (aCont1);
  if (nSize1 == 0)
    return newSet (aCont2);

  final int nSize2 = ArrayHelper.getSize (aCont2);
  if (nSize2 == 0)
    return newSet (aCont1);

  final ICommonsSet <ELEMENTTYPE> ret = newSet (nSize1 + nSize2);
  ret.addAll (aCont1);
  Collections.addAll (ret, aCont2);
  return ret;
}
 
Example 3
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public static <ELEMENTTYPE> ICommonsSet <ELEMENTTYPE> getConcatenatedSet (@Nullable final ELEMENTTYPE [] aCont1,
                                                                          @Nullable final Collection <? extends ELEMENTTYPE> aCont2)
{
  final int nSize1 = ArrayHelper.getSize (aCont1);
  if (nSize1 == 0)
    return newSet (aCont2);

  final int nSize2 = getSize (aCont2);
  if (nSize2 == 0)
    return newSet (aCont1);

  final ICommonsSet <ELEMENTTYPE> ret = newSet (nSize1 + nSize2);
  Collections.addAll (ret, aCont1);
  ret.addAll (aCont2);
  return ret;
}