java.util.stream.IntStream.concat()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中java.util.stream.IntStream.concat()方法的一些代码示例,展示了IntStream.concat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IntStream.concat()方法的具体详情如下:
包路径:java.util.stream.IntStream
类名称:IntStream
方法名:concat

IntStream.concat介绍

暂无

代码示例

代码示例来源:origin: graphhopper/graphhopper

@Override
public int length() {
  return IntStream.concat(
      IntStream.of(baseGraph.getAllEdges().length() - 1),
      extraEdges.stream().mapToInt(VirtualEdgeIteratorState::getEdge))
      .max().getAsInt()+1;
}

代码示例来源:origin: graphhopper/graphhopper

@Override
public int getNodes() {
  return IntStream.concat(
      IntStream.of(baseGraph.getNodes()-1),
      extraEdges.stream().flatMapToInt(edge -> IntStream.of(edge.getBaseNode(), edge.getAdjNode())))
      .max().getAsInt()+1;
}

代码示例来源:origin: graphhopper/graphhopper

@Override
public int getNodes() {
  return IntStream.concat(
      IntStream.of(graphHopperStorage.getNodes()-1),
      additionalEdges.stream().flatMapToInt(edge -> IntStream.of(edge.getBaseNode(), edge.getAdjNode())))
      .max().getAsInt()+1;
}

代码示例来源:origin: aol/cyclops

@Deprecated //moved to cyclops.companion.Functions
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> concatInts( ReactiveSeq<Integer> b){
  return a->fromSpliterator(IntStream.concat(a.mapToInt(i->i),b.mapToInt(i->i)).spliterator());
}

代码示例来源:origin: aol/cyclops

public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> concatInts( ReactiveSeq<Integer> b){
  return a->ReactiveSeq.fromSpliterator(IntStream.concat(a.mapToInt(i->i),b.mapToInt(i->i)).spliterator());
}

代码示例来源:origin: stackoverflow.com

import java.util.Optional;
import java.util.stream.IntStream;

public class StringHelper {
  public static String capitalize(String source) {
    return Optional.ofNullable(source)
      .map(str -> IntStream.concat(
        str.codePoints().limit(1).map(Character::toUpperCase),
        str.codePoints().skip(1)))
      .map(stream -> stream.toArray())
      .map(arr -> new String(arr, 0, arr.length))
      .orElse(null);
  }
}

代码示例来源:origin: org.bitbucket.iamkenos/cissnei-commons

private static CharSequence asciiLetters() {
  return IntStream.concat(IntStream.rangeClosed('A','Z'), IntStream.rangeClosed('a','z'))
      .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append);
}

代码示例来源:origin: radsz/jacop

/**
 * @param list    array of variables to be summed up
 * @param weights variables' weights
 * @param sum     resulting sum
 */
public SumWeightDom(IntVar[] list, int[] weights, IntVar sum) {
  checkInputForNullness(new String[] {"list", "weights"}, new Object[][] {list, {weights}});
  commonInitialization(Stream.concat(Arrays.stream(list), Stream.of(sum)).toArray(IntVar[]::new),
    IntStream.concat(Arrays.stream(weights), IntStream.of(-1)).toArray(), 0);
}

代码示例来源:origin: de.sciss/jacop

/**
 * It constructs the constraint SumWeightDom.
 * @param list list which are being multiplied by weights.
 * @param weights weight for each variable.
 * @param sum variable containing the sum of weighted list.
 */
public SumWeightDom(List<? extends IntVar> list, List<Integer> weights, IntVar sum) {
  checkInputForNullness(new String[]{"list", "weights"}, new Object[][]{{list}, { weights }});
  commonInitialization(Stream.concat(list.stream(), Stream.of(sum)).toArray(IntVar[]::new),
    IntStream.concat(weights.stream().mapToInt(i -> i), IntStream.of(-1)).toArray(),
    0);
}

代码示例来源:origin: de.sciss/jacop

/**
 * @param list array of variables to be summed up
 * @param weights variables' weights
 * @param sum resulting sum
 */
public SumWeightDom(IntVar[] list, int[] weights, IntVar sum) {
  checkInputForNullness(new String[]{"list", "weights"}, new Object[][]{list, { weights }});
  commonInitialization(Stream.concat(Arrays.stream(list), Stream.of(sum)).toArray(IntVar[]::new),
             IntStream.concat(Arrays.stream(weights), IntStream.of(-1)).toArray(),
             0);
}

代码示例来源:origin: radsz/jacop

/**
 * It constructs the constraint SumWeightDom.
 *
 * @param list    list which are being multiplied by weights.
 * @param weights weight for each variable.
 * @param sum     variable containing the sum of weighted list.
 */
public SumWeightDom(List<? extends IntVar> list, List<Integer> weights, IntVar sum) {
  checkInputForNullness(new String[] {"list", "weights"}, new Object[][] {{list}, {weights}});
  commonInitialization(Stream.concat(list.stream(), Stream.of(sum)).toArray(IntVar[]::new),
    IntStream.concat(weights.stream().mapToInt(i -> i), IntStream.of(-1)).toArray(), 0);
}

代码示例来源: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: BruceEckel/OnJava8-Examples

public static void main(String[] args) {
  Stream.of(1, 2, 3, 4, 5)
   .flatMapToInt(i -> IntStream.concat(
    rand.ints(0, 100).limit(i), IntStream.of(-1)))
   .forEach(n -> System.out.format("%d ", n));
 }
}

代码示例来源:origin: de.sciss/jacop

/**
 * @param list    variables which are being multiplied by weights.
 * @param weights weight for each variable.
 * @param rel     the relation, one of "==", "{@literal <}", "{@literal >}", "{@literal <=}", "{@literal >=}", "{@literal !=}"
 * @param sum     the sum of weighted variables.
 */
public LinearInt(IntVar[] list, int[] weights, String rel, IntVar sum) {
  checkInputForNullness("list", list);
  checkInputForNullness("weights", weights);
  commonInitialization(sum.getStore(), Stream.concat(Arrays.stream(list), Stream.of(sum)).toArray(IntVar[]::new),
    IntStream.concat(Arrays.stream(weights), IntStream.of(-1)).toArray(), rel, 0);
  numberId = idNumber.incrementAndGet();
}

代码示例来源:origin: radsz/jacop

/**
 * @param list    variables which are being multiplied by weights.
 * @param weights weight for each variable.
 * @param rel     the relation, one of "==", "{@literal <}", "{@literal >}", "{@literal <=}", "{@literal >=}", "{@literal !=}"
 * @param sum     the sum of weighted variables.
 */
public LinearInt(IntVar[] list, int[] weights, String rel, IntVar sum) {
  checkInputForNullness("list", list);
  checkInputForNullness("weights", weights);
  commonInitialization(sum.getStore(), Stream.concat(Arrays.stream(list), Stream.of(sum)).toArray(IntVar[]::new),
    IntStream.concat(Arrays.stream(weights), IntStream.of(-1)).toArray(), rel, 0);
  numberId = idNumber.incrementAndGet();
}

代码示例来源:origin: com.oath.cyclops/cyclops

@Deprecated //moved to cyclops.companion.Functions
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> concatInts( ReactiveSeq<Integer> b){
  return a->fromSpliterator(IntStream.concat(a.mapToInt(i->i),b.mapToInt(i->i)).spliterator());
}

代码示例来源:origin: one.util/streamex

/**
 * Creates a lazily concatenated stream whose elements are all the elements
 * of the other stream followed by all the elements of this stream. The
 * resulting stream is ordered if both of the input streams are ordered, and
 * parallel if either of the input streams is parallel. When the resulting
 * stream is closed, the close handlers for both input streams are invoked.
 *
 * @param other the other stream
 * @return this stream prepended by the other stream
 * @see IntStream#concat(IntStream, IntStream)
 */
public IntStreamEx prepend(IntStream other) {
  return new IntStreamEx(IntStream.concat(other, stream()), context.combine(other));
}

代码示例来源:origin: ml.alternet/alternet-tools

public CharRange union(Chars chars) {
  if ( ! (this.equal ^ chars.equal) ) {
    return new Chars(
      this.equal,
      IntStream.concat(this.chars.codePoints(), chars.chars.codePoints() )
    );
  } else {
    return new Ranges(this, chars);
  }
}

代码示例来源:origin: com.oath.cyclops/cyclops

public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> concatInts( ReactiveSeq<Integer> b){
  return a->ReactiveSeq.fromSpliterator(IntStream.concat(a.mapToInt(i->i),b.mapToInt(i->i)).spliterator());
}

代码示例来源:origin: com.aol.simplereact/cyclops-react

public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> concatInts( ReactiveSeq<Integer> b){
  return a->fromSpliterator(IntStream.concat(a.mapToInt(i->i),b.mapToInt(i->i)).spliterator());
}

相关文章