Supplier 部分
class NatualSupplier implements Supplier<Integer> { private final int[] temp = new int[]{1, 1, 0}; private int index = -1; @Override public Integer get() { index++; if (index < 2) { return temp[index]; } return (temp[index % 3] = temp[(index - 1) % 3] + temp[(index - 2) % 3]); } }
Sign in to make a reply
忒修斯之船
Supplier 部分