List of usage examples for com.google.common.collect Lists newArrayListWithCapacity
@GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayListWithCapacity(int initialArraySize)
From source file:com.netflix.astyanax.thrift.model.ThriftCqlRowsImpl.java
public ThriftCqlRowsImpl(final List<CqlRow> rows, final Serializer<K> keySer, final Serializer<C> colSer) { this.rows = Lists.newArrayListWithCapacity(rows.size()); for (CqlRow row : rows) { byte[] keyBytes = row.getKey(); if (keyBytes == null || keyBytes.length == 0) { this.rows.add( new ThriftRowImpl<K, C>(null, null, new ThriftColumnListImpl<C>(row.getColumns(), colSer))); } else {//from w w w .java2 s . co m this.rows.add(new ThriftRowImpl<K, C>(keySer.fromBytes(keyBytes), ByteBuffer.wrap(keyBytes), new ThriftColumnListImpl<C>(row.getColumns(), colSer))); } } }
From source file:org.gradoop.model.impl.operators.matching.common.matching.EntityMatcher.java
/** * Returns all query candidate ids for the given EPGM element. * * @param dbElement EPGM element (vertices/edges) * @param queryElements query graph elements (vertices/edges) * @param <EL1> EPGM element type * @param <EL2> GDL element type * @return all candidate ids for {@code dbElement} *//* w ww . jav a 2 s . c om*/ public static <EL1 extends EPGMElement, EL2 extends GraphElement> List<Long> getMatches(EL1 dbElement, Collection<EL2> queryElements) { List<Long> matches = Lists.newArrayListWithCapacity(queryElements.size()); for (GraphElement queryElement : queryElements) { if (match(dbElement, queryElement)) { matches.add(queryElement.getId()); } } return matches; }
From source file:org.gradoop.flink.model.impl.operators.matching.common.matching.EntityMatcher.java
/** * Returns all query candidate ids for the given EPGM element. * * @param dbElement EPGM element (vertices/edges) * @param queryElements query graph elements (vertices/edges) * @param <EL1> EPGM element type * @param <EL2> GDL element type * @return all candidate ids for {@code dbElement} *///from w ww .j a va2 s . c o m public static <EL1 extends Element, EL2 extends GraphElement> List<Long> getMatches(EL1 dbElement, Collection<EL2> queryElements) { List<Long> matches = Lists.newArrayListWithCapacity(queryElements.size()); for (GraphElement queryElement : queryElements) { if (match(dbElement, queryElement)) { matches.add(queryElement.getId()); } } return matches; }
From source file:net.myrrix.online.AbstractRescorerProvider.java
public static RescorerProvider loadRescorerProviders(String classNamesString, URL url) { if (classNamesString == null || classNamesString.isEmpty()) { return null; }/*from w w w . ja va 2 s. com*/ String[] classNames = COMMA.split(classNamesString); if (classNames.length == 1) { return loadOneRescorerProvider(classNames[0], url); } List<RescorerProvider> providers = Lists.newArrayListWithCapacity(classNames.length); for (String className : classNames) { providers.add(loadOneRescorerProvider(className, url)); } return new MultiRescorerProvider(providers); }
From source file:com.netflix.astyanax.thrift.model.ThriftRowsListImpl.java
public ThriftRowsListImpl(Map<ByteBuffer, List<ColumnOrSuperColumn>> rows, Serializer<K> keySer, Serializer<C> colSer) {//from w w w. j a va2 s.c o m this.rows = Lists.newArrayListWithCapacity(rows.size()); this.lookup = Maps.newLinkedHashMap(); for (Entry<ByteBuffer, List<ColumnOrSuperColumn>> row : rows.entrySet()) { Row<K, C> thriftRow = new ThriftRowImpl<K, C>(keySer.fromByteBuffer(row.getKey().duplicate()), row.getKey(), new ThriftColumnOrSuperColumnListImpl<C>(row.getValue(), colSer)); this.rows.add(thriftRow); lookup.put(thriftRow.getKey(), thriftRow); } }
From source file:com.android.build.gradle.internal.model.SourceProviderContainerImpl.java
@NonNull static List<SourceProviderContainer> cloneCollection(@NonNull Collection<SourceProviderContainer> containers) { List<SourceProviderContainer> clones = Lists.newArrayListWithCapacity(containers.size()); for (SourceProviderContainer container : containers) { clones.add(clone(container));/* w ww .j a v a2 s . c o m*/ } return clones; }
From source file:org.eclipse.xtext.common.types.access.binary.asm.BinarySuperTypeSignature.java
public List<BinaryGenericTypeSignature> getSuperTypes() { int index = offset; if (chars.charAt(offset) == '<') { int count = 1; while (count > 0 && ++index < offset + length) { switch (chars.charAt(index)) { case '<': count++;// w w w .ja va 2 s . c o m break; case '>': count--; break; } } index++; } List<BinaryGenericTypeSignature> result = Lists.newArrayListWithCapacity(2); while (index != offset + length) { int end = SignatureUtil.scanTypeSignature(chars, index) + 1; result.add(new BinaryGenericTypeSignature(chars, index, end - index)); index = end; } return result; }
From source file:com.spotify.apollo.meta.model.EndpointInfoGatherer.java
Model.EndpointInfo endpointInfo() { endpointInfo.method = Lists.newArrayList(methods); endpointInfo.queryParameters = Lists.newArrayListWithCapacity(queryParameters.size()); for (String name : queryParameters) { endpointInfo.queryParameters.add(new Model.QueryParameter(name)); }/*from w ww. j a v a 2 s . c o m*/ return endpointInfo; }
From source file:org.terasology.entitysystem.component.ComponentCopyFunction.java
@SuppressWarnings("unchecked") public ComponentCopyFunction(ComponentPropertyInfo<T> typeInfo, TypeLibrary typeLibrary) { this.propertyCopiers = Lists.newArrayListWithCapacity(typeInfo.getProperties().size()); for (PropertyAccessor accessor : typeInfo.getProperties().values()) { Optional<TypeHandler<?>> handler = typeLibrary.getHandlerFor(accessor.getPropertyType()); if (handler.isPresent()) { propertyCopiers.add(createPropertyCopy(accessor, handler.get())); } else {//from w w w .ja v a 2s . c o m logger.error("No type handler available for {}, property {}::{} will not be supported", accessor.getPropertyType(), accessor.getOwningClass().getTypeName(), accessor.getName()); } } }
From source file:com.hengyi.japp.execution.Util.java
public static void queryCommand(CriteriaBuilder cb, CriteriaQuery<?> cq, Root<Customer> root, CustomerQueryCommand command) {/*from w w w .j ava 2s . c om*/ List<Predicate> ps = Lists.newArrayListWithCapacity(2); ps.add(cb.equal(root.get(Customer_.deleteFlag), command.isDeleteFlag())); if (!isBlank(command.getName())) { ps.add(cb.like(root.get(Customer_.name), command.getNameQuery())); } cq.where(ps.toArray(new Predicate[ps.size()])); }