当前位置: 首页>>代码示例>>Java>>正文


Java Builder.build方法代码示例

本文整理汇总了Java中java.util.stream.Stream.Builder.build方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.build方法的具体用法?Java Builder.build怎么用?Java Builder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.stream.Stream.Builder的用法示例。


在下文中一共展示了Builder.build方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lines

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
private Stream<ValuePair<Point3d, Vector3d>> lines(final long bins,
	final double sign)
{
	final Vector3d direction = getNormal(sign);
	final Vector3d t = new Vector3d(translation);
	t.scale(sign);
	final double range = 1.0 / bins;
	final Builder<ValuePair<Point3d, Vector3d>> builder = Stream.builder();
	for (int i = 0; i < bins; i++) {
		final double minC = i * range;
		for (int j = 0; j < bins; j++) {
			final double minD = j * range;
			final double c = (rng.nextDouble() * range + minC) * size - 0.5 *
				size;
			final double d = (rng.nextDouble() * range + minD) * size - 0.5 *
				size;
			final Point3d origin = createOrigin(c, d, t);
			builder.add(new ValuePair<>(origin, direction));
		}
	}
	return builder.build();
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:LineGrid.java

示例2: getParameters

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
@Parameters
public static <T, R> Stream<Object[]> getParameters(
		FunctionTester<T, R> input) {
	Builder<Object[]> b = Stream.builder();
	for (int i = 0; i < input.getInput().size(); i++) {
		Matcher<? super R> result = input.getResult().get(i).get();
		T param = input.getInput().get(i).get();
		String name = input.getName().get(i).get();
		if ("".equals(name)) {
			name = "Passing `" + param + "`" + " then " + result
					+ " is expected";
		}
		b.add(new Object[] { name, param, result, input.getUnderTest() });
	}
	return b.build();
}
 
开发者ID:powerunit,项目名称:powerunit,代码行数:17,代码来源:FunctionTesterImpl.java

示例3: getDatas

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
@Parameters
public static <T, A, R> Stream<Object[]> getDatas(
		CollectorTester<T, A, R> input) {
	StringDescription sdChar = new StringDescription();
	input.getExpectedCharacteristics().describeTo(sdChar);
	Builder<Object[]> builder = Stream.builder();
	for (int i = 0; i < input.getInputs().size(); i++) {
		StringDescription sd = new StringDescription();
		input.getResults().get(i).describeTo(sd);
		builder.add(new Object[] {
				input.getCollectorToTest(),
				i == 0,
				input.getInputs().get(i),
				input.getResults().get(i),
				sd.toString(),
				input.getExpectedCharacteristics(),
				sdChar.toString(),
				(BiFunction<String, Object[], Boolean>) CollectorTesterImpl::filter });
	}
	return builder.build();
}
 
开发者ID:powerunit,项目名称:powerunit,代码行数:22,代码来源:CollectorTesterImpl.java

示例4: getParameters

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
@Parameters
public static <T, U, R> Stream<Object[]> getParameters(
		BiFunctionTester<T, U, R> input) {
	Builder<Object[]> b = Stream.builder();
	for (int i = 0; i < input.getInput1().size(); i++) {
		Matcher<? super R> result = input.getResult().get(i).get();
		T param1 = input.getInput1().get(i).get();
		U param2 = input.getInput2().get(i).get();
		String name = input.getName().get(i).get();
		if ("".equals(name)) {
			name = "Passing `" + param1 + "` and `" + param2 + "`"
					+ " then " + result + " is expected";
		}
		b.add(new Object[] { name, param1, param2, result,
				input.getUnderTest() });
	}
	return b.build();
}
 
开发者ID:powerunit,项目名称:powerunit,代码行数:19,代码来源:BiFunctionTesterImpl.java

示例5: polygonsFrom

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
public static Stream<Polygon> polygonsFrom(Geometry g) {
    if (g instanceof Polygon) {
        return Stream.of((Polygon) g);
    }
    else if (g instanceof MultiPolygon) {
        Builder<Polygon> builder = Stream.builder();
        for (int i = 0; i < g.getNumGeometries(); i++) {
            builder.add((Polygon) g.getGeometryN(i));
        }
        return builder.build();
    }
    return Stream.empty();
}
 
开发者ID:Mappy,项目名称:fpm,代码行数:14,代码来源:PolygonsUtils.java

示例6: findAuthors

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
public Stream<String> findAuthors() {
    final Builder<String> authors = Stream.builder();
    for (PositionedData<Directive> directive : directives) {
        if ( "author".equals(directive.data.name.toLowerCase()) ) {
            authors.add(directive.data.value);
        }
    }
    return authors.build();
}
 
开发者ID:kawane,项目名称:songbook,代码行数:10,代码来源:Song.java

示例7: getParameters

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
@Parameters
public static Stream<Object[]> getParameters(PatternTester input) {
	Builder<Object[]> builder = Stream.builder();
	for (int i = 0; i < input.getInputs().size(); i++) {
		builder.add(new Object[] { input.getUnderTest(),
				input.getInputs().get(i), input.getExpectedResult().get(i),
				input.getHavingGroup().get(i),
				input.getExpectedGroup().get(i),
				input.getUnderTest().pattern() });
	}
	return builder.build();
}
 
开发者ID:powerunit,项目名称:powerunit,代码行数:13,代码来源:PatternTesterImpl.java

示例8: getParameter

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
@Parameters
public static Stream<Object[]> getParameter(MatcherTester input) {
	Builder<Object[]> builder = Stream.builder();
	for (int i = 0; i < input.getExpectedGroup().size(); i++) {
		StringDescription sd = new StringDescription();
		input.getExpectedGroup().get(i).describeTo(sd);
		builder.add(new Object[] { input.getMatcher(),
				input.getMatcher().pattern().pattern(), input.getInput(),
				input.getHavingGroup().get(i),
				input.getExpectedGroup().get(i), sd.toString() });
	}
	return builder.build();
}
 
开发者ID:powerunit,项目名称:powerunit,代码行数:14,代码来源:MatcherTesterImpl.java

示例9: findSplitAxisIndices

import java.util.stream.Stream.Builder; //导入方法依赖的package包/类
/**
 * Splits the hyperstack into subspaces defined by the given axes.
 * <p>
 * If all the given axis types are not found in the hyperstack, gives
 * subspaces of the found types. If none of the types are found, returns an
 * empty stream. For example, if you want to split a {X, Y, C, T} hyperstack
 * into {X, Y, Z}, returns all the {X, Y} subspaces.
 * </p>
 * <p>
 * NB Assumes that the given {@link ImgPlus} has the necessary metadata, i.e.
 * its {@link CalibratedAxis} have {@link AxisType}.
 * </p>
 *
 * @param hyperStack an N-dimensional image.
 * @param <T> type of the elements in the image.
 * @param subspaceTypes the types of the axis in the desired subspace.
 * @return a stream of all the subspaces found.
 */
public static <T extends RealType<T> & NativeType<T>> Stream<Subspace<T>>
	splitSubspaces(final ImgPlus<T> hyperStack, List<AxisType> subspaceTypes)
{
	if (subspaceTypes == null || subspaceTypes.isEmpty()) {
		return Stream.empty();
	}
	final Builder<Subspace<T>> builder = Stream.builder();
	final int[] splitIndices = findSplitAxisIndices(hyperStack, subspaceTypes);
	final long[] typeSubscripts = mapTypeSubscripts(hyperStack, splitIndices);
	final int numSplits = splitIndices.length;
	final HyperAxisMeta[] subspaceMeta = new HyperAxisMeta[numSplits];
	final List<ValuePair<IntType, LongType>> split = new ArrayList<>();
	splitDims(hyperStack, splitIndices, numSplits - 1, subspaceMeta, split,
		typeSubscripts, builder);
	return builder.build();
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:35,代码来源:HyperstackUtils.java


注:本文中的java.util.stream.Stream.Builder.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。