Java 8 partition list

后端 未结 5 2203
一个人的身影
一个人的身影 2021-02-18 15:37

Is it possible to partition a List in pure Jdk8 into equal chunks (sublists).

I know it is possible using Guava Lists class, but can we do it with pure Jdk? I don\'t wan

5条回答
  •  死守一世寂寞
    2021-02-18 16:05

    Guava Lists class has a partition() method that does exactly this. See https://guava.dev/releases/21.0/api/docs/com/google/common/collect/Lists.html#partition-java.util.List-int-

提交回复
热议问题