本文整理了Java中java.util.stream.IntStream.skip()
方法的一些代码示例,展示了IntStream.skip()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IntStream.skip()
方法的具体详情如下:
包路径:java.util.stream.IntStream
类名称:IntStream
方法名:skip
[英]Returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream. If this stream contains fewer than n elements then an empty stream will be returned.
This is a stateful intermediate operation.
[中]在丢弃流的前n个元素后,返回由该流的其余元素组成的流。如果此流包含少于n个元素,则将返回一个空流。
这是一个stateful intermediate operation。
代码示例来源:origin: speedment/speedment
public IntSkipAction(long n) {
super(s -> s.skip(n), IntStream.class, SKIP);
this.skip = n;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Add a single object into the script context.
*
* @param key the name in the context this object is to stored under.
* @param bean the object to be stored in the script context.
*/
public void addBean(String key, Object bean) {
if (!key.isEmpty() && Character.isJavaIdentifierStart(key.charAt(0))
&& key.chars().skip(1).allMatch(Character::isJavaIdentifierPart)) {
beans.put(key, bean);
}
}
代码示例来源:origin: speedment/speedment
@Override
public IntStream skip(long n) {
return wrap(stream().skip(n));
}
代码示例来源:origin: ivan-vasilev/neuralnetworks
public Tensor(int startOffset, float[] elements, int[] globalDimensions, int[][] globalDimensionsLimit)
{
super();
if (globalDimensions == null || globalDimensions.length == 0)
{
throw new IllegalArgumentException("Please provide dimensions");
}
this.startOffset = startOffset;
this.elements = elements;
this.globalDimensions = globalDimensions;
this.globalDimensionsLimit = globalDimensionsLimit;
this.dimTmp = new int[globalDimensions.length];
this.dimensions = new int[(int) IntStream.range(0, globalDimensions.length)
.filter(i -> globalDimensionsLimit[0][i] != globalDimensionsLimit[1][i] || globalDimensionsLimit[1][i] - globalDimensionsLimit[0][i] + 1 == globalDimensions[i]).count()];
for (int i = 0, j = 0; i < globalDimensions.length; i++)
{
if (globalDimensionsLimit[0][i] != globalDimensionsLimit[1][i] || globalDimensionsLimit[1][i] - globalDimensionsLimit[0][i] + 1 == globalDimensions[i])
{
dimensions[j++] = globalDimensionsLimit[1][i] - globalDimensionsLimit[0][i] + 1;
}
}
this.dimMultiplicators = new int[dimensions.length];
IntStream.range(0, dimMultiplicators.length).forEach(i -> {
dimMultiplicators[i] = 1;
Arrays.stream(globalDimensions).skip(i + 1).limit(globalDimensions.length).forEach(j -> dimMultiplicators[i] *= j);
});
size = IntStream.range(0, dimensions.length).map(i -> dimensions[i]).reduce(1, (a, b) -> a * b);
}
代码示例来源:origin: speedment/speedment
@Override
@SuppressWarnings("unchecked")
public TS build(boolean parallel) {
final TS built = previous().build(parallel);
if (built instanceof Stream<?>) {
return (TS) ((Stream<T>) built).skip(skip);
} else if (built instanceof IntStream) {
return (TS) ((IntStream) built).skip(skip);
} else if (built instanceof LongStream) {
return (TS) ((LongStream) built).skip(skip);
} else if (built instanceof DoubleStream) {
return (TS) ((DoubleStream) built).skip(skip);
} else {
throw new UnsupportedOperationException(
"Built stream did not match any known stream interface."
);
}
}
}
代码示例来源:origin: aol/cyclops
@Deprecated //moved to cyclops.companion.Functions
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> skipInts(long skip){
return a->a.ints(i->i,s->s.skip(skip));
}
/*
代码示例来源:origin: aol/cyclops
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> skipInts(long skip){
return a->a.ints(i->i,s->s.skip(skip));
}
/*
代码示例来源:origin: matyb/java-koans
@Koan
public void limitSkip() {
int lengthSum_Limit_3_Skip_1 = places.stream()
.mapToInt(String::length)
.limit(3)
.skip(1)
.sum();
assertEquals(lengthSum_Limit_3_Skip_1, __);
}
代码示例来源:origin: com.aol.simplereact/cyclops-react
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> skipInts(long skip){
return a->a.ints(i->i,s->s.skip(skip));
}
/*
代码示例来源:origin: stackoverflow.com
import java.util.stream.IntStream;
public class Test {
private static final int[] arr = {5, 3, 4, 2, 9, 1, 7, 8, 6};
public static void main(String[] args) throws Exception {
int n = Integer.parseInt(args[0]);
System.out.println("Finding "+n+" largest numbers in arr");
IntStream.of(arr).sorted().skip(arr.length-n).boxed().forEach(big -> System.out.println(big));
}
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Deprecated //moved to cyclops.companion.Functions
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> skipInts(long skip){
return a->a.ints(i->i,s->s.skip(skip));
}
/*
代码示例来源:origin: io.usethesource/capsule-experimental
@Deprecated
@Override
int arity() {
// TODO: replace with 32 - arity(emptyMap)
// return arity(bitmap(), PATTERN_DATA_SINGLETON) + arity(bitmap(), PATTERN_DATA_COLLECTION) +
// arity(bitmap(), PATTERN_NODE);
int[] arities = arities(bitmap());
return Arrays.stream(arities).skip(1).sum();
}
代码示例来源:origin: ml.alternet/alternet-tools
static String changeFirstChar(String s, IntFunction<Integer> charChange) {
int[] cp = IntStream.concat(
IntStream.of(charChange.apply(s.codePointAt(0))),
s.codePoints().skip(1)
).toArray();
return new String(cp, 0, cp.length);
}
代码示例来源:origin: org.bsc.processor/java2ts-processor-core
/**
*
* @param type
* @return
*/
public Set<Method> getMethods() {
final Predicate<Method> include = m -> !m.isBridge() && !m.isSynthetic() && Modifier.isPublic(m.getModifiers())
&& Character.isJavaIdentifierStart(m.getName().charAt(0))
&& m.getName().chars().skip(1).allMatch(Character::isJavaIdentifierPart);
return Stream.concat(Stream.of(getValue().getMethods()), Stream.of(getValue().getDeclaredMethods()))
.filter(include).collect(Collectors.toSet());
}
代码示例来源:origin: usethesource/capsule
@Deprecated
@Override
int arity() {
// TODO: replace with 32 - arity(emptyMap)
// return arity(bitmap(), PATTERN_DATA_SINGLETON) + arity(bitmap(), PATTERN_DATA_COLLECTION) +
// arity(bitmap(), PATTERN_NODE);
int[] arities = arities(bitmap());
return Arrays.stream(arities).skip(1).sum();
}
代码示例来源:origin: org.bsc.processor/java2ts-processor-core
/**
*
* @param type
* @return
*/
public Set<Field> getFields() {
final Predicate<Field> std = f -> !f.isSynthetic() && Modifier.isPublic(f.getModifiers())
&& Character.isJavaIdentifierStart(f.getName().charAt(0))
&& f.getName().chars().skip(1).allMatch(Character::isJavaIdentifierPart);
return Stream.concat(Stream.of(getValue().getFields()), Stream.of(getValue().getDeclaredFields())).filter(std)
.collect(Collectors.toSet());
}
代码示例来源:origin: usethesource/capsule
@Deprecated
@Override
int arity() {
// TODO: replace with 32 - arity(emptyMap)
// return arity(bitmap(), PATTERN_DATA_SINGLETON) + arity(bitmap(), PATTERN_DATA_COLLECTION) +
// arity(bitmap(), PATTERN_NODE);
int[] arities = arities(bitmap());
return Arrays.stream(arities).skip(1).sum();
}
代码示例来源:origin: io.usethesource/capsule-experimental
@Deprecated
@Override
int arity() {
// TODO: replace with 32 - arity(emptyMap)
// return arity(bitmap(), PATTERN_DATA_SINGLETON) + arity(bitmap(), PATTERN_DATA_COLLECTION) +
// arity(bitmap(), PATTERN_NODE);
int[] arities = arities(bitmap());
return Arrays.stream(arities).skip(1).sum();
}
代码示例来源:origin: OpenGamma/Strata
private int findHeadPoints(int required) {
// Take enough points that aren't NaN
// else we need the entire series
return validIndices()
.skip(required)
.findFirst()
.orElse(points.length);
}
代码示例来源:origin: OpenGamma/Strata
private int findTailPoints(int required) {
return reversedValidIndices()
.skip(required - 1)
.findFirst()
.orElse(0);
}
内容来源于网络,如有侵权,请联系作者删除!