Example usage for java.util.function ObjIntConsumer accept

List of usage examples for java.util.function ObjIntConsumer accept

Introduction

In this page you can find the example usage for java.util.function ObjIntConsumer accept.

Prototype

void accept(T t, int value);

Source Link

Document

Performs this operation on the given arguments.

Usage

From source file:Main.java

public static void main(String[] args) {
    ObjIntConsumer<String> i = (s, d) -> System.out.println(s + d);

    i.accept("java2s.com ", 234);
}

From source file:cn.edu.zjnu.acm.judge.contest.ContestController.java

@SuppressWarnings("ValueOfIncrementOrDecrementUsed")
private <T> void setIndexes(T[] standings, Comparator<T> c, ObjIntConsumer<T> consumer) {
    Objects.requireNonNull(standings, "standings");
    Objects.requireNonNull(c, "c");
    Objects.requireNonNull(consumer, "consumer");
    int i = 0, len = standings.length, lastIndex = 0;

    for (T last = null, standing; i < len; last = standing) {
        standing = standings[i++];/*w  w w  .j a v  a2s .c o  m*/
        if (c.compare(standing, last) != 0) {
            lastIndex = i;
        }
        consumer.accept(standing, lastIndex);
    }
}