本文整理了Java中org.eclipse.collections.impl.list.fixed.ArrayAdapter
类的一些代码示例,展示了ArrayAdapter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayAdapter
类的具体详情如下:
包路径:org.eclipse.collections.impl.list.fixed.ArrayAdapter
类名称:ArrayAdapter
[英]This class provides a MutableList wrapper around an array. All of the internal iteration methods of the MutableList interface as well as the JDK Collections List interface are provided. However, the pre-determined fixed-sized semantics of an array are maintained and thus mutating List interface methods such as #add(Object), #addAll(Collection), #remove(Object), #removeAll(Collection), etc. are not supported and will throw an UnsupportedOperationException. In addition, the mutating iteration methods #removeIf(org.eclipse.collections.api.block.predicate.Predicate) and #removeIfWith(org.eclipse.collections.api.block.predicate.Predicate2,Object) are not supported and will also throw an UnsupportedOperationException.
The #with(Object) method is not an exception to the above restrictions, as it will create a new instance of this class with the existing contents plus the new item.
To create a wrapper around an existing array, use the #adapt(Object[]) factory method. To wrap the contents of an existing Collection instance, use the #newArray(Iterable) or #newArrayWithItem(Iterable,Object)factory methods. To wrap existing objects in a new array, use one of the #newArrayWith(Object) factory methods.
[中]此类提供了数组周围的可变列表包装器。提供了可变列表接口和JDK集合列表接口的所有内部迭代方法。但是,数组的预先确定的固定大小语义将得到维护,因此不支持诸如#add(Object)、#addAll(Collection)、#remove(Object)和#removeAll(Collection)等改变列表接口的方法,并将引发UnsupportedOperationException。此外,不支持变异迭代方法#removeIf(org.eclipse.collections.api.block.predicate.predicate)和#removeIfWith(org.eclipse.collections.api.block.predicate.Predicate2,Object),它们还将抛出不支持的操作异常。
#with(Object)方法并非上述限制的例外,因为它将使用现有内容和新项创建此类的新实例。
要围绕现有数组创建包装器,请使用#adapt(Object[])工厂方法。要包装现有集合实例的内容,请使用#newArray(Iterable)或#newarraywhitem(Iterable,Object)工厂方法。要将现有对象包装到新数组中,请使用#newArrayWith(Object)工厂方法之一。
代码示例来源:origin: eclipse/eclipse-collections
@Override
public MutableMap<K, V> withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs)
{
return this.withAllKeyValues(ArrayAdapter.adapt(keyValuePairs));
}
代码示例来源:origin: eclipse/eclipse-collections
public static <E> ArrayAdapter<E> adapt(E... array)
{
return new ArrayAdapter<>(array);
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public FixedSizeList<T> toReversed()
{
ArrayAdapter<T> result = this.clone();
result.reverseThis();
return result;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public ArrayAdapter<T> without(T element)
{
if (this.contains(element))
{
return ArrayAdapter.newArray(this.toList().without(element));
}
return this;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public ArrayAdapter<T> withAll(Iterable<? extends T> elements)
{
if (Iterate.isEmpty(elements))
{
return this;
}
return ArrayAdapter.newArray(this.toList().withAll(elements));
}
代码示例来源:origin: com.goldmansachs.obevo/obevo-core
protected static ImmutableList<String> iterString(ImmutableHierarchicalConfiguration c, String path) {
String string = c.getString(path);
if (!StringUtils.isBlank(string)) {
String[] parts = string.trim().split("\\s*,\\s*");
return ArrayAdapter.adapt(parts).toImmutable();
}
return Lists.immutable.empty();
}
代码示例来源:origin: BNYMellon/CodeKatas
public Order(Customer customer, LocalDate date, String donutTypeCounts)
{
this.customer = customer;
ArrayAdapter.adapt(donutTypeCounts.split(","))
.asLazy()
.collect(pair -> pair.split(":"))
.collect(pair -> PrimitiveTuples.pair(DonutType.forAbbreviation(pair[0]), Integer.parseInt(pair[1])))
.each(this::add);
this.date = date;
}
代码示例来源:origin: goldmansachs/obevo
/**
* We shuffle the list to test out the fact that we can guarantee a particular order of traversal.
*/
private static <T> MutableList<T> shuffledList(T... inputs) {
return ArrayAdapter.adapt(inputs).shuffleThis();
}
}
代码示例来源:origin: jkazama/sample-boot-micro
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().mvcMatchers(
ArrayAdapter.adapt(props.auth().getIgnorePath())
.collect(dispatcherServletRegistration::getRelativePath)
.toArray(new String[0]));
}
代码示例来源:origin: goldmansachs/obevo
dbArgs.setProductVersion(args.getProductVersion());
if (args.getChangesets() != null && args.getChangesets().length > 0) {
dbArgs.setChangesetNames(ArrayAdapter.adapt(args.getChangesets()).toSet().toImmutable());
代码示例来源:origin: eclipse/eclipse-collections
@Override
public FixedSizeList<T> tap(Procedure<? super T> procedure)
{
this.each(procedure);
return this;
}
代码示例来源:origin: goldmansachs/obevo
protected static ImmutableList<String> iterString(ImmutableHierarchicalConfiguration c, String path) {
String string = c.getString(path);
if (!StringUtils.isBlank(string)) {
String[] parts = string.trim().split("\\s*,\\s*");
return ArrayAdapter.adapt(parts).toImmutable();
}
return Lists.immutable.empty();
}
代码示例来源:origin: BNYMellon/CodeKatas
public Order(Customer customer, LocalDate date, String donutTypeCounts)
{
this.customer = customer;
ArrayAdapter.adapt(donutTypeCounts.split(","))
.asLazy()
.collect(pair -> pair.split(":"))
.collect(pair -> PrimitiveTuples.pair(DonutType.forAbbreviation(pair[0]), Integer.parseInt(pair[1])))
.each(this::add);
this.date = date;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public ArrayAdapter<T> without(T element)
{
if (this.contains(element))
{
return ArrayAdapter.newArray(this.toList().without(element));
}
return this;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public ArrayAdapter<T> withAll(Iterable<? extends T> elements)
{
if (Iterate.isEmpty(elements))
{
return this;
}
return ArrayAdapter.newArray(this.toList().withAll(elements));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public FixedSizeList<T> tap(Procedure<? super T> procedure)
{
this.each(procedure);
return this;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public MutableMap<K, V> withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValues)
{
return this.withAllKeyValues(ArrayAdapter.adapt(keyValues));
}
代码示例来源:origin: com.goldmansachs.obevo/obevo-core
public static ObjectTypeAndNamePredicateBuilder parse(String input, FilterType filterType) {
ImmutableList<String> fullPredicateParts = ArrayAdapter.adapt(input.split(PREDICATE_SPLITTER)).toImmutable();
MutableListMultimap<String, String> objectNamesByType = Multimaps.mutable.list.empty();
for (String fullPredicatePart : fullPredicateParts) {
ImmutableList<String> predicatePart = ArrayAdapter.adapt(fullPredicatePart.split(SINGLE_PREDICATE_SPLITTER)).toImmutable();
Validate.isTrue(predicatePart.size() == 2, "Must only have 1 delimiter " + SINGLE_PREDICATE_SPLITTER + " in this clause " + fullPredicatePart + " to find 2 parts, but found " + predicatePart.size() + " parts");
for (String objectName : predicatePart.get(1).split(PART_SPLITTER)) {
objectNamesByType.put(predicatePart.get(0), objectName);
}
}
return new ObjectTypeAndNamePredicateBuilder(objectNamesByType.toImmutable(), filterType);
}
代码示例来源:origin: eclipse/eclipse-collections
public static <E> ArrayAdapter<E> newArrayWith(E one, E two, E three, E four, E five, E six)
{
return new ArrayAdapter<>((E[]) new Object[]{one, two, three, four, five, six});
}
代码示例来源:origin: org.eclipse.collections/eclipse-collections
@Override
public ArrayAdapter<T> without(T element)
{
if (this.contains(element))
{
return ArrayAdapter.newArray(this.toList().without(element));
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!