Working with arrays of lists pattern in java

I am writing a card game in java where I need to spread cards from a deck into several columns until I have fixed amount of cards left. This is how I do this.
public class Column extends ArrayList {}
List deck = Cards.createNewDeck();
Column[] columns = new Column[10];
int c = 0;

while (deck.size() > 50) {
    if (c == 10) {
        c = 0;
    if (columns[c] == null) {
        columns[c] = new Column();
    c += 1;
This somehow seems clunky. Is there a more readable/comprehensive way of doing the same thing?

以上就是Working with arrays of lists pattern in java的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准