本文整理匯總了Java中com.google.common.collect.Streams.concat方法的典型用法代碼示例。如果您正苦於以下問題:Java Streams.concat方法的具體用法?Java Streams.concat怎麽用?Java Streams.concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.Streams
的用法示例。
在下文中一共展示了Streams.concat方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSemiBlocks
import com.google.common.collect.Streams; //導入方法依賴的package包/類
public Stream<ISemiBlock> getSemiBlocks(World world, BlockPos pos) {
Stream<ISemiBlock> stream = null;
Chunk chunk = world.getChunkFromBlockCoords(pos);
Map<BlockPos, List<ISemiBlock>> map = semiBlocks.get(chunk);
if (map != null) {
List<ISemiBlock> semiblocks = map.get(pos);
if(semiblocks != null){
stream = semiblocks.stream().filter(semiBlock -> !semiBlock.isInvalid());
}
}
//Semiblocks that _just_ have been added, but not the the chunk maps yet.
Stream<ISemiBlock> addingStream = addingBlocks.stream()
.filter(semiBlock -> semiBlock.getWorld() == world &&
semiBlock.getPos().equals(pos) &&
!semiBlock.isInvalid());
if(stream == null){
return addingStream;
}else{
return Streams.concat(stream, addingStream);
}
}
示例2: makeStatusValueList
import com.google.common.collect.Streams; //導入方法依賴的package包/類
/**
* Creates a string array of status values.
*
* <p>The spec indicates that OK should be listed as "active". We use the "removed" status to
* indicate deleted objects.
*/
private static ImmutableList<String> makeStatusValueList(
ImmutableSet<StatusValue> statusValues, boolean isDeleted) {
Stream<RdapStatus> stream =
statusValues
.stream()
.map(status -> statusToRdapStatusMap.getOrDefault(status, RdapStatus.OBSCURED));
if (isDeleted) {
stream =
Streams.concat(
stream.filter(rdapStatus -> !Objects.equals(rdapStatus, RdapStatus.ACTIVE)),
Stream.of(RdapStatus.REMOVED));
}
return stream
.map(RdapStatus::getDisplayName)
.collect(toImmutableSortedSet(Ordering.natural()))
.asList();
}
示例3: getSemiBlocksInArea
import com.google.common.collect.Streams; //導入方法依賴的package包/類
public Stream<ISemiBlock> getSemiBlocksInArea(World world, AxisAlignedBB aabb){
List<Chunk> applicableChunks = new ArrayList<Chunk>();
int minX = (int)aabb.minX;
int minY = (int)aabb.minY;
int minZ = (int)aabb.minZ;
int maxX = (int)aabb.maxX;
int maxY = (int)aabb.maxY;
int maxZ = (int)aabb.maxZ;
//Get the relevant chunks.
for (int x = minX; x < maxX + 16; x += 16) {
for (int z = minZ; z < maxZ + 16; z += 16) {
Chunk chunk = world.getChunkFromBlockCoords(new BlockPos(x, 0, z));
applicableChunks.add(chunk);
}
}
//Retrieve all semi block storages from the relevant chunks
Stream<Map<BlockPos, List<ISemiBlock>>> chunkMaps = applicableChunks.stream()
.map(chunk -> getSemiBlocks().get(chunk))
.filter(map -> map != null);
Stream<List<ISemiBlock>> semiBlocksPerPos = chunkMaps.flatMap(map -> map.values().stream());
Stream<ISemiBlock> existingSemiBlocksInArea = semiBlocksPerPos.flatMap(semiBlockLists -> semiBlockLists.stream());
Stream<ISemiBlock> allSemiBlocksInArea = Streams.concat(existingSemiBlocksInArea, addingBlocks.stream());
return allSemiBlocksInArea.filter(s -> !s.isInvalid() &&
minX <= s.getPos().getX() && s.getPos().getX() <= maxX &&
minY <= s.getPos().getY() && s.getPos().getY() <= maxY &&
minZ <= s.getPos().getZ() && s.getPos().getZ() <= maxZ);
}
示例4: Bibliography
import com.google.common.collect.Streams; //導入方法依賴的package包/類
public Bibliography(Taxon taxon) {
this.taxon = taxon;
mapper = new ObjectMapper();
mapper.disable(
MapperFeature.AUTO_DETECT_CREATORS,
MapperFeature.AUTO_DETECT_FIELDS,
MapperFeature.AUTO_DETECT_GETTERS,
MapperFeature.AUTO_DETECT_IS_GETTERS,
MapperFeature.AUTO_DETECT_SETTERS);
mapper.addMixIn(Reference.class, ReferenceSerializer.class);
if(taxon.looksAccepted()) {
referenceStream = Streams.concat(
taxon.getReferences().stream(),
taxon.getDescriptions().stream().flatMap(d -> d.getReferences().stream()),
taxon.getDistribution().stream().flatMap(d -> d.getReferences().stream()),
taxon.getSynonymNameUsages().stream().flatMap(
synonym -> synonym.getDescriptions().stream().flatMap(
description -> description.getReferences().stream())));
} else {
referenceStream = taxon.getReferences().stream();
}
liturature = referenceStream.collect(groupingBy(r -> classify(r),
toCollection(() -> new TreeSet<>(new ReferenceComparator()))));
accepted = liturature.remove("Accepted");
notAccepted = liturature.remove("Not accepted");
if(liturature.isEmpty()) {
liturature = null;
}
logger.debug("Constructed Bibliography:{}", this.toString());
}
示例5: search
import com.google.common.collect.Streams; //導入方法依賴的package包/類
private Stream<Object> search(EntityType entityType, Query<Entity> q, int offset, int pageSize)
{
QueryBuilder query = contentGenerators.createQuery(q, entityType);
Sort sort = q.getSort() != null ? contentGenerators.createSorts(q.getSort(), entityType) : null;
Index index = contentGenerators.createIndex(entityType);
Stream<SearchHit> searchHits = Stream.empty();
boolean done = false;
int currentOffset;
int i = 0;
while (!done)
{
int batchSize = pageSize < MAX_BATCH_SIZE && pageSize != 0 ? pageSize : MAX_BATCH_SIZE;
currentOffset = offset + (i * MAX_BATCH_SIZE);
SearchHits currentSearchHits = clientFacade.search(query, currentOffset, batchSize, sort, index);
searchHits = Streams.concat(searchHits, currentSearchHits.getHits().stream());
if (currentSearchHits.getHits().size() < MAX_BATCH_SIZE)
{
done = true;
}
if (pageSize != 0) pageSize -= MAX_BATCH_SIZE;
i++;
}
return toEntityIds(entityType, searchHits.map(SearchHit::getId));
}
示例6: all
import com.google.common.collect.Streams; //導入方法依賴的package包/類
public Stream<ExternalId> all() {
return Streams.concat(removed.stream(), updated.stream());
}
示例7: allSubstatementsStream
import com.google.common.collect.Streams; //導入方法依賴的package包/類
default Stream<? extends StmtContext<?, ?, ?>> allSubstatementsStream() {
return Streams.concat(declaredSubstatements().stream(), effectiveSubstatements().stream());
}