本文整理汇总了Java中org.apache.commons.collections4.CollectionUtils.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.addAll方法的具体用法?Java CollectionUtils.addAll怎么用?Java CollectionUtils.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.CollectionUtils
的用法示例。
在下文中一共展示了CollectionUtils.addAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putAll
import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
/**
* Adds Iterable values to the collection associated with the specified key.
*
* @param key the key to store against
* @param values the values to add to the collection at the key, may not be null
* @return true if this map changed
* @throws NullPointerException if values is null
*/
@Override
public boolean putAll(final K key, final Iterable<? extends V> values) {
if (values == null) {
throw new NullPointerException("Values must not be null.");
}
if (values instanceof Collection<?>) {
Collection<? extends V> valueCollection = (Collection<? extends V>) values;
return !valueCollection.isEmpty() && get(key).addAll(valueCollection);
} else {
Iterator<? extends V> it = values.iterator();
return it.hasNext() && CollectionUtils.addAll(get(key), it);
}
}
示例2: putAll
import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
@Override
public boolean putAll(final K key, final Iterable<? extends V> values) {
if (values == null) {
throw new NullPointerException("Values must not be null.");
}
final Iterable<V> transformedValues = FluentIterable.of(values).transform(valueTransformer);
final Iterator<? extends V> it = transformedValues.iterator();
return it.hasNext() && CollectionUtils.addAll(decorated().get(transformKey(key)), it);
}
示例3: addIfBigger
import org.apache.commons.collections4.CollectionUtils; //导入方法依赖的package包/类
public void addIfBigger(String compareVersion) {
ArrayList<String> cV = new ArrayList();
CollectionUtils.addAll(cV, compareVersion.split("\\."));
if (isBigger(cV)) {
version.clear();
version.addAll(cV);
}
}